fail_empty_struct.carbon 784 B

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