fail_incomplete_element.carbon 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. class Incomplete;
  7. // CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+6]]:22: ERROR: Variable has incomplete type `[Incomplete; 1]`.
  8. // CHECK:STDERR: var a: [Incomplete; 1];
  9. // CHECK:STDERR: ^
  10. // CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-5]]:1: Class was forward declared here.
  11. // CHECK:STDERR: class Incomplete;
  12. // CHECK:STDERR: ^
  13. var a: [Incomplete; 1];
  14. // CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+3]]:27: ERROR: Cannot implicitly convert from `<error>*` to `Incomplete*`.
  15. // CHECK:STDERR: var p: Incomplete* = &a[0];
  16. // CHECK:STDERR: ^
  17. var p: Incomplete* = &a[0];
  18. // CHECK:STDOUT: file "fail_incomplete_element.carbon" {
  19. // CHECK:STDOUT: class_declaration @Incomplete, ()
  20. // CHECK:STDOUT: %Incomplete: type = class_type @Incomplete
  21. // CHECK:STDOUT: %Incomplete.ref.loc15: type = name_reference "Incomplete", %Incomplete
  22. // CHECK:STDOUT: %.loc15_21: i32 = int_literal 1
  23. // CHECK:STDOUT: %.loc15_22: type = array_type %.loc15_21, Incomplete
  24. // CHECK:STDOUT: %a: ref <error> = var "a"
  25. // CHECK:STDOUT: %Incomplete.ref.loc20: type = name_reference "Incomplete", %Incomplete
  26. // CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete
  27. // CHECK:STDOUT: %p: ref Incomplete* = var "p"
  28. // CHECK:STDOUT: %a.ref: ref <error> = name_reference "a", %a
  29. // CHECK:STDOUT: %.loc20_25: i32 = int_literal 0
  30. // CHECK:STDOUT: %.loc20_22.1: type = ptr_type <error>
  31. // CHECK:STDOUT: %.loc20_22.2: <error>* = address_of <error>
  32. // CHECK:STDOUT: assign %p, <error>
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: class @Incomplete;