empty_struct.carbon 541 B

123456789101112131415161718192021222324252627
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // NOAUTOUPDATE
  6. package ExplorerTest api;
  7. impl {} as EqWith({}) {
  8. fn Equal[self: Self](other: Self) -> bool {
  9. return true;
  10. }
  11. fn NotEqual[self: Self](other: Self) -> bool {
  12. return false;
  13. }
  14. }
  15. fn Main() -> i32 {
  16. var empty: auto = {};
  17. if (empty == {}) {
  18. return 0;
  19. } else {
  20. return 1;
  21. }
  22. }
  23. // CHECK:STDOUT: result: 0