fail_empty_struct.carbon 789 B

1234567891011121314151617181920212223242526272829
  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. // AUTOUPDATE
  6. // RUN: %{not} %{explorer-run}
  7. // RUN: %{not} %{explorer-run-trace}
  8. package ExplorerTest api;
  9. // TODO: This should work
  10. // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/comparison/fail_empty_struct.carbon:[[@LINE+1]]: type error in call: '({})' is not implicitly convertible to '(Type)'
  11. external impl {} as EqWith({}) {
  12. fn Equal[me: Self](other: Self) -> bool {
  13. return true;
  14. }
  15. fn NotEqual[me: Self](other: Self) -> bool {
  16. return false;
  17. }
  18. }
  19. fn Main() -> i32 {
  20. var empty: auto = {};
  21. if (empty == {}) {
  22. return 0;
  23. } else {
  24. return 1;
  25. }
  26. }