fail_nested_incomplete.carbon 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. // CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE+3]]:1: 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: --- fail_nested_incomplete.carbon
  19. // CHECK:STDOUT:
  20. // CHECK:STDOUT: constants {
  21. // CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template]
  22. // CHECK:STDOUT: %.1: type = struct_type {.a: Incomplete} [template]
  23. // CHECK:STDOUT: %.2: type = ptr_type Incomplete [template]
  24. // CHECK:STDOUT: %.3: type = ptr_type <error> [template]
  25. // CHECK:STDOUT: }
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: file {
  28. // CHECK:STDOUT: package: <namespace> = namespace package, {.Incomplete = %Incomplete.decl, .s = %s, .p = %p} [template]
  29. // CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, ()
  30. // CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, constants.%Incomplete [template = constants.%Incomplete]
  31. // CHECK:STDOUT: %.loc15: type = struct_type {.a: Incomplete} [template = constants.%.1]
  32. // CHECK:STDOUT: %s.var: ref <error> = var s
  33. // CHECK:STDOUT: %s: ref <error> = bind_name s, %s.var
  34. // CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, constants.%Incomplete [template = constants.%Incomplete]
  35. // CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete [template = constants.%.2]
  36. // CHECK:STDOUT: %p.var: ref Incomplete* = var p
  37. // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var
  38. // CHECK:STDOUT: %s.ref: ref <error> = name_ref s, %s
  39. // CHECK:STDOUT: %.loc20_22: <error>* = addr_of <error> [template = <error>]
  40. // CHECK:STDOUT: assign %p.var, <error>
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: class @Incomplete;
  44. // CHECK:STDOUT: