fail_nested_incomplete.carbon 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 `(i32, Incomplete)`.
  8. // CHECK:STDERR: var t: (i32, 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 t: (i32, Incomplete);
  14. var p: Incomplete* = &t[1];
  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 = tuple_type (type, type) [template]
  20. // CHECK:STDOUT: %.2: type = tuple_type (i32, Incomplete) [template]
  21. // CHECK:STDOUT: %.3: type = ptr_type Incomplete [template]
  22. // CHECK:STDOUT: %.4: i32 = int_literal 1 [template]
  23. // CHECK:STDOUT: }
  24. // CHECK:STDOUT:
  25. // CHECK:STDOUT: file {
  26. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  27. // CHECK:STDOUT: .Core = %Core
  28. // CHECK:STDOUT: .Incomplete = %Incomplete.decl
  29. // CHECK:STDOUT: .t = %t
  30. // CHECK:STDOUT: .p = %p
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  33. // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {}
  34. // CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete]
  35. // CHECK:STDOUT: %.loc15_24.1: (type, type) = tuple_literal (i32, %Incomplete.ref.loc15)
  36. // CHECK:STDOUT: %.loc15_24.2: type = converted %.loc15_24.1, constants.%.2 [template = constants.%.2]
  37. // CHECK:STDOUT: %t.var: ref <error> = var t
  38. // CHECK:STDOUT: %t: ref <error> = bind_name t, %t.var
  39. // CHECK:STDOUT: %Incomplete.ref.loc17: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete]
  40. // CHECK:STDOUT: %.loc17: type = ptr_type Incomplete [template = constants.%.3]
  41. // CHECK:STDOUT: %p.var: ref Incomplete* = var p
  42. // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var
  43. // CHECK:STDOUT: }
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: class @Incomplete;
  46. // CHECK:STDOUT:
  47. // CHECK:STDOUT: fn @__global_init() {
  48. // CHECK:STDOUT: !entry:
  49. // CHECK:STDOUT: %t.ref: ref <error> = name_ref t, file.%t
  50. // CHECK:STDOUT: %.loc17_25: i32 = int_literal 1 [template = constants.%.4]
  51. // CHECK:STDOUT: %.loc17_22: <error> = addr_of <error> [template = <error>]
  52. // CHECK:STDOUT: assign file.%p.var, <error>
  53. // CHECK:STDOUT: return
  54. // CHECK:STDOUT: }
  55. // CHECK:STDOUT: