fail_nested_incomplete.carbon 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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]]:8: 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. var p: Incomplete* = &s.a;
  15. // CHECK:STDOUT: --- fail_nested_incomplete.carbon
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: constants {
  18. // CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template]
  19. // CHECK:STDOUT: %.1: type = struct_type {.a: Incomplete} [template]
  20. // CHECK:STDOUT: %.2: type = ptr_type Incomplete [template]
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: file {
  24. // CHECK:STDOUT: package: <namespace> = namespace {.Incomplete = %Incomplete.decl, .s = %s, .p = %p} [template]
  25. // CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, ()
  26. // CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, constants.%Incomplete [template = constants.%Incomplete]
  27. // CHECK:STDOUT: %.loc15: type = struct_type {.a: Incomplete} [template = constants.%.1]
  28. // CHECK:STDOUT: %s.var: ref <error> = var s
  29. // CHECK:STDOUT: %s: ref <error> = bind_name s, %s.var
  30. // CHECK:STDOUT: %Incomplete.ref.loc17: type = name_ref Incomplete, constants.%Incomplete [template = constants.%Incomplete]
  31. // CHECK:STDOUT: %.loc17: type = ptr_type Incomplete [template = constants.%.2]
  32. // CHECK:STDOUT: %p.var: ref Incomplete* = var p
  33. // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: class @Incomplete;
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: fn @__global_init() {
  39. // CHECK:STDOUT: !entry:
  40. // CHECK:STDOUT: %s.ref: ref <error> = name_ref s, file.%s
  41. // CHECK:STDOUT: %.loc17: <error> = addr_of <error> [template = <error>]
  42. // CHECK:STDOUT: assign file.%p.var, <error>
  43. // CHECK:STDOUT: return
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT: