fail_nested_incomplete.carbon 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  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: file "fail_nested_incomplete.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: type = struct_type {.a: Incomplete}
  23. // CHECK:STDOUT: %s: ref <error> = var "s"
  24. // CHECK:STDOUT: %Incomplete.ref.loc20: type = name_reference "Incomplete", %Incomplete
  25. // CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete
  26. // CHECK:STDOUT: %p: ref Incomplete* = var "p"
  27. // CHECK:STDOUT: %s.ref: ref <error> = name_reference "s", %s
  28. // CHECK:STDOUT: %.loc20_22.1: type = ptr_type <error>
  29. // CHECK:STDOUT: %.loc20_22.2: <error>* = address_of <error>
  30. // CHECK:STDOUT: assign %p, <error>
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT:
  33. // CHECK:STDOUT: class @Incomplete;