fail_incomplete_element.carbon 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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: constants {
  19. // CHECK:STDOUT: %.loc20: type = ptr_type <error>
  20. // CHECK:STDOUT: }
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: file "fail_incomplete_element.carbon" {
  23. // CHECK:STDOUT: class_decl @Incomplete, ()
  24. // CHECK:STDOUT: %Incomplete: type = class_type @Incomplete
  25. // CHECK:STDOUT: %Incomplete.ref.loc15: type = name_reference Incomplete, %Incomplete
  26. // CHECK:STDOUT: %.loc15_21: i32 = int_literal 1
  27. // CHECK:STDOUT: %.loc15_22: type = array_type %.loc15_21, Incomplete
  28. // CHECK:STDOUT: %a.var: ref <error> = var a
  29. // CHECK:STDOUT: %a: ref <error> = bind_name a, %a.var
  30. // CHECK:STDOUT: %Incomplete.ref.loc20: type = name_reference Incomplete, %Incomplete
  31. // CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete
  32. // CHECK:STDOUT: %p.var: ref Incomplete* = var p
  33. // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var
  34. // CHECK:STDOUT: %a.ref: ref <error> = name_reference a, %a
  35. // CHECK:STDOUT: %.loc20_25: i32 = int_literal 0
  36. // CHECK:STDOUT: %.loc20_22: <error>* = address_of <error>
  37. // CHECK:STDOUT: assign %p.var, <error>
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT:
  40. // CHECK:STDOUT: class @Incomplete;