fail_nested_incomplete.carbon 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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_nested_incomplete.carbon:[[@LINE+6]]:23: ERROR: Variable has incomplete type `{.a: Incomplete}`.
  8. // CHECK:STDERR: var s: {.a: Incomplete};
  9. // CHECK:STDERR: ^
  10. // CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE-5]]:1: Class was forward declared here.
  11. // CHECK:STDERR: class Incomplete;
  12. // CHECK:STDERR: ^
  13. var s: {.a: Incomplete};
  14. // CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE+3]]:26: ERROR: Cannot implicitly convert from `<error>*` to `Incomplete*`.
  15. // CHECK:STDERR: var p: Incomplete* = &s.a;
  16. // CHECK:STDERR: ^
  17. var p: Incomplete* = &s.a;
  18. // CHECK:STDOUT: constants {
  19. // CHECK:STDOUT: %.loc20: type = ptr_type <error>
  20. // CHECK:STDOUT: }
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: file "fail_nested_incomplete.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: type = struct_type {.a: Incomplete}
  27. // CHECK:STDOUT: %s.var: ref <error> = var s
  28. // CHECK:STDOUT: %s: ref <error> = bind_name s, %s.var
  29. // CHECK:STDOUT: %Incomplete.ref.loc20: type = name_reference Incomplete, %Incomplete
  30. // CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete
  31. // CHECK:STDOUT: %p.var: ref Incomplete* = var p
  32. // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var
  33. // CHECK:STDOUT: %s.ref: ref <error> = name_reference s, %s
  34. // CHECK:STDOUT: %.loc20_22: <error>* = address_of <error>
  35. // CHECK:STDOUT: assign %p.var, <error>
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: class @Incomplete;