fail_empty_struct.carbon 715 B

12345678910111213141516171819202122232425
  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. }
  15. fn Main() -> i32 {
  16. var empty: auto = {};
  17. if (empty == {}) {
  18. return 0;
  19. } else {
  20. return 1;
  21. }
  22. }