derived_to_base.carbon 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/derived_to_base.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/derived_to_base.carbon
  10. base class A {
  11. var a: i32;
  12. }
  13. base class B {
  14. extend base: A;
  15. var b: i32;
  16. }
  17. class C {
  18. extend base: B;
  19. var c: i32;
  20. }
  21. fn ConvertCToB(p: C*) -> B* { return p; }
  22. fn ConvertBToA(p: B*) -> A* { return p; }
  23. fn ConvertCToA(p: C*) -> A* { return p; }
  24. fn ConvertValue(c: C) {
  25. let a: A = c;
  26. }
  27. fn ConvertRef(c: C*) -> A* {
  28. return &(*c as A);
  29. }
  30. fn ConvertInit() {
  31. let a: A = {.base = {.base = {.a = 1}, .b = 2}, .c = 3} as C;
  32. }
  33. // CHECK:STDOUT: --- derived_to_base.carbon
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: constants {
  36. // CHECK:STDOUT: %A: type = class_type @A [template]
  37. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  38. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  39. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  40. // CHECK:STDOUT: %.2: type = unbound_element_type %A, i32 [template]
  41. // CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template]
  42. // CHECK:STDOUT: %.4: <witness> = complete_type_witness %.3 [template]
  43. // CHECK:STDOUT: %B: type = class_type @B [template]
  44. // CHECK:STDOUT: %.5: type = ptr_type %.3 [template]
  45. // CHECK:STDOUT: %.6: type = unbound_element_type %B, %A [template]
  46. // CHECK:STDOUT: %.7: type = unbound_element_type %B, i32 [template]
  47. // CHECK:STDOUT: %.8: type = struct_type {.base: %A, .b: i32} [template]
  48. // CHECK:STDOUT: %.9: <witness> = complete_type_witness %.8 [template]
  49. // CHECK:STDOUT: %C: type = class_type @C [template]
  50. // CHECK:STDOUT: %.10: type = struct_type {.base: %.5, .b: i32} [template]
  51. // CHECK:STDOUT: %.11: type = ptr_type %.10 [template]
  52. // CHECK:STDOUT: %.12: type = ptr_type %.8 [template]
  53. // CHECK:STDOUT: %.13: type = unbound_element_type %C, %B [template]
  54. // CHECK:STDOUT: %.14: type = unbound_element_type %C, i32 [template]
  55. // CHECK:STDOUT: %.15: type = struct_type {.base: %B, .c: i32} [template]
  56. // CHECK:STDOUT: %.16: <witness> = complete_type_witness %.15 [template]
  57. // CHECK:STDOUT: %.17: type = ptr_type %C [template]
  58. // CHECK:STDOUT: %.18: type = ptr_type %B [template]
  59. // CHECK:STDOUT: %ConvertCToB.type: type = fn_type @ConvertCToB [template]
  60. // CHECK:STDOUT: %ConvertCToB: %ConvertCToB.type = struct_value () [template]
  61. // CHECK:STDOUT: %.19: type = struct_type {.base: %.12, .c: i32} [template]
  62. // CHECK:STDOUT: %.20: type = ptr_type %.19 [template]
  63. // CHECK:STDOUT: %.21: type = ptr_type %.15 [template]
  64. // CHECK:STDOUT: %.22: type = ptr_type %A [template]
  65. // CHECK:STDOUT: %ConvertBToA.type: type = fn_type @ConvertBToA [template]
  66. // CHECK:STDOUT: %ConvertBToA: %ConvertBToA.type = struct_value () [template]
  67. // CHECK:STDOUT: %ConvertCToA.type: type = fn_type @ConvertCToA [template]
  68. // CHECK:STDOUT: %ConvertCToA: %ConvertCToA.type = struct_value () [template]
  69. // CHECK:STDOUT: %ConvertValue.type: type = fn_type @ConvertValue [template]
  70. // CHECK:STDOUT: %ConvertValue: %ConvertValue.type = struct_value () [template]
  71. // CHECK:STDOUT: %ConvertRef.type: type = fn_type @ConvertRef [template]
  72. // CHECK:STDOUT: %ConvertRef: %ConvertRef.type = struct_value () [template]
  73. // CHECK:STDOUT: %ConvertInit.type: type = fn_type @ConvertInit [template]
  74. // CHECK:STDOUT: %ConvertInit: %ConvertInit.type = struct_value () [template]
  75. // CHECK:STDOUT: %.23: i32 = int_literal 1 [template]
  76. // CHECK:STDOUT: %.24: i32 = int_literal 2 [template]
  77. // CHECK:STDOUT: %.25: type = struct_type {.base: %.3, .b: i32} [template]
  78. // CHECK:STDOUT: %.26: i32 = int_literal 3 [template]
  79. // CHECK:STDOUT: %.27: type = struct_type {.base: %.25, .c: i32} [template]
  80. // CHECK:STDOUT: %struct.1: %A = struct_value (%.23) [template]
  81. // CHECK:STDOUT: %struct.2: %B = struct_value (%struct.1, %.24) [template]
  82. // CHECK:STDOUT: %struct.3: %C = struct_value (%struct.2, %.26) [template]
  83. // CHECK:STDOUT: }
  84. // CHECK:STDOUT:
  85. // CHECK:STDOUT: imports {
  86. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  87. // CHECK:STDOUT: .Int32 = %import_ref
  88. // CHECK:STDOUT: import Core//prelude
  89. // CHECK:STDOUT: import Core//prelude/operators
  90. // CHECK:STDOUT: import Core//prelude/types
  91. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  92. // CHECK:STDOUT: import Core//prelude/operators/as
  93. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  94. // CHECK:STDOUT: import Core//prelude/operators/comparison
  95. // CHECK:STDOUT: import Core//prelude/types/bool
  96. // CHECK:STDOUT: }
  97. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT:
  100. // CHECK:STDOUT: file {
  101. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  102. // CHECK:STDOUT: .Core = imports.%Core
  103. // CHECK:STDOUT: .A = %A.decl
  104. // CHECK:STDOUT: .B = %B.decl
  105. // CHECK:STDOUT: .C = %C.decl
  106. // CHECK:STDOUT: .ConvertCToB = %ConvertCToB.decl
  107. // CHECK:STDOUT: .ConvertBToA = %ConvertBToA.decl
  108. // CHECK:STDOUT: .ConvertCToA = %ConvertCToA.decl
  109. // CHECK:STDOUT: .ConvertValue = %ConvertValue.decl
  110. // CHECK:STDOUT: .ConvertRef = %ConvertRef.decl
  111. // CHECK:STDOUT: .ConvertInit = %ConvertInit.decl
  112. // CHECK:STDOUT: }
  113. // CHECK:STDOUT: %Core.import = import Core
  114. // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} {}
  115. // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} {}
  116. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  117. // CHECK:STDOUT: %ConvertCToB.decl: %ConvertCToB.type = fn_decl @ConvertCToB [template = constants.%ConvertCToB] {
  118. // CHECK:STDOUT: %p.patt: %.17 = binding_pattern p
  119. // CHECK:STDOUT: %p.param_patt: %.17 = param_pattern %p.patt, runtime_param0
  120. // CHECK:STDOUT: } {
  121. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  122. // CHECK:STDOUT: %.loc25_20: type = ptr_type %C [template = constants.%.17]
  123. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
  124. // CHECK:STDOUT: %.loc25_27: type = ptr_type %B [template = constants.%.18]
  125. // CHECK:STDOUT: %return: ref %.18 = var <return slot>
  126. // CHECK:STDOUT: %param: %.17 = param runtime_param0
  127. // CHECK:STDOUT: %p: %.17 = bind_name p, %param
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT: %ConvertBToA.decl: %ConvertBToA.type = fn_decl @ConvertBToA [template = constants.%ConvertBToA] {
  130. // CHECK:STDOUT: %p.patt: %.18 = binding_pattern p
  131. // CHECK:STDOUT: %p.param_patt: %.18 = param_pattern %p.patt, runtime_param0
  132. // CHECK:STDOUT: } {
  133. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
  134. // CHECK:STDOUT: %.loc26_20: type = ptr_type %B [template = constants.%.18]
  135. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
  136. // CHECK:STDOUT: %.loc26_27: type = ptr_type %A [template = constants.%.22]
  137. // CHECK:STDOUT: %return: ref %.22 = var <return slot>
  138. // CHECK:STDOUT: %param: %.18 = param runtime_param0
  139. // CHECK:STDOUT: %p: %.18 = bind_name p, %param
  140. // CHECK:STDOUT: }
  141. // CHECK:STDOUT: %ConvertCToA.decl: %ConvertCToA.type = fn_decl @ConvertCToA [template = constants.%ConvertCToA] {
  142. // CHECK:STDOUT: %p.patt: %.17 = binding_pattern p
  143. // CHECK:STDOUT: %p.param_patt: %.17 = param_pattern %p.patt, runtime_param0
  144. // CHECK:STDOUT: } {
  145. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  146. // CHECK:STDOUT: %.loc27_20: type = ptr_type %C [template = constants.%.17]
  147. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
  148. // CHECK:STDOUT: %.loc27_27: type = ptr_type %A [template = constants.%.22]
  149. // CHECK:STDOUT: %return: ref %.22 = var <return slot>
  150. // CHECK:STDOUT: %param: %.17 = param runtime_param0
  151. // CHECK:STDOUT: %p: %.17 = bind_name p, %param
  152. // CHECK:STDOUT: }
  153. // CHECK:STDOUT: %ConvertValue.decl: %ConvertValue.type = fn_decl @ConvertValue [template = constants.%ConvertValue] {
  154. // CHECK:STDOUT: %c.patt: %C = binding_pattern c
  155. // CHECK:STDOUT: %c.param_patt: %C = param_pattern %c.patt, runtime_param0
  156. // CHECK:STDOUT: } {
  157. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  158. // CHECK:STDOUT: %param: %C = param runtime_param0
  159. // CHECK:STDOUT: %c: %C = bind_name c, %param
  160. // CHECK:STDOUT: }
  161. // CHECK:STDOUT: %ConvertRef.decl: %ConvertRef.type = fn_decl @ConvertRef [template = constants.%ConvertRef] {
  162. // CHECK:STDOUT: %c.patt: %.17 = binding_pattern c
  163. // CHECK:STDOUT: %c.param_patt: %.17 = param_pattern %c.patt, runtime_param0
  164. // CHECK:STDOUT: } {
  165. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  166. // CHECK:STDOUT: %.loc33_19: type = ptr_type %C [template = constants.%.17]
  167. // CHECK:STDOUT: %A.ref.loc33: type = name_ref A, file.%A.decl [template = constants.%A]
  168. // CHECK:STDOUT: %.loc33_26: type = ptr_type %A [template = constants.%.22]
  169. // CHECK:STDOUT: %return: ref %.22 = var <return slot>
  170. // CHECK:STDOUT: %param: %.17 = param runtime_param0
  171. // CHECK:STDOUT: %c: %.17 = bind_name c, %param
  172. // CHECK:STDOUT: }
  173. // CHECK:STDOUT: %ConvertInit.decl: %ConvertInit.type = fn_decl @ConvertInit [template = constants.%ConvertInit] {} {}
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT:
  176. // CHECK:STDOUT: class @A {
  177. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  178. // CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32]
  179. // CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32]
  180. // CHECK:STDOUT: %.loc12_8: %.2 = field_decl a, element0 [template]
  181. // CHECK:STDOUT: %.loc13: <witness> = complete_type_witness %.3 [template = constants.%.4]
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: !members:
  184. // CHECK:STDOUT: .Self = constants.%A
  185. // CHECK:STDOUT: .a = %.loc12_8
  186. // CHECK:STDOUT: }
  187. // CHECK:STDOUT:
  188. // CHECK:STDOUT: class @B {
  189. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
  190. // CHECK:STDOUT: %.loc16: %.6 = base_decl %A, element0 [template]
  191. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  192. // CHECK:STDOUT: %.loc17_10.1: type = value_of_initializer %int.make_type_32 [template = i32]
  193. // CHECK:STDOUT: %.loc17_10.2: type = converted %int.make_type_32, %.loc17_10.1 [template = i32]
  194. // CHECK:STDOUT: %.loc17_8: %.7 = field_decl b, element1 [template]
  195. // CHECK:STDOUT: %.loc18: <witness> = complete_type_witness %.8 [template = constants.%.9]
  196. // CHECK:STDOUT:
  197. // CHECK:STDOUT: !members:
  198. // CHECK:STDOUT: .Self = constants.%B
  199. // CHECK:STDOUT: .base = %.loc16
  200. // CHECK:STDOUT: .b = %.loc17_8
  201. // CHECK:STDOUT: extend name_scope2
  202. // CHECK:STDOUT: }
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: class @C {
  205. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
  206. // CHECK:STDOUT: %.loc21: %.13 = base_decl %B, element0 [template]
  207. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  208. // CHECK:STDOUT: %.loc22_10.1: type = value_of_initializer %int.make_type_32 [template = i32]
  209. // CHECK:STDOUT: %.loc22_10.2: type = converted %int.make_type_32, %.loc22_10.1 [template = i32]
  210. // CHECK:STDOUT: %.loc22_8: %.14 = field_decl c, element1 [template]
  211. // CHECK:STDOUT: %.loc23: <witness> = complete_type_witness %.15 [template = constants.%.16]
  212. // CHECK:STDOUT:
  213. // CHECK:STDOUT: !members:
  214. // CHECK:STDOUT: .Self = constants.%C
  215. // CHECK:STDOUT: .base = %.loc21
  216. // CHECK:STDOUT: .c = %.loc22_8
  217. // CHECK:STDOUT: extend name_scope3
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  221. // CHECK:STDOUT:
  222. // CHECK:STDOUT: fn @ConvertCToB(%p.param_patt: %.17) -> %.18 {
  223. // CHECK:STDOUT: !entry:
  224. // CHECK:STDOUT: %p.ref: %.17 = name_ref p, %p
  225. // CHECK:STDOUT: %.loc25_39.1: ref %C = deref %p.ref
  226. // CHECK:STDOUT: %.loc25_39.2: ref %B = class_element_access %.loc25_39.1, element0
  227. // CHECK:STDOUT: %.loc25_39.3: %.18 = addr_of %.loc25_39.2
  228. // CHECK:STDOUT: %.loc25_39.4: %.18 = converted %p.ref, %.loc25_39.3
  229. // CHECK:STDOUT: return %.loc25_39.4
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: fn @ConvertBToA(%p.param_patt: %.18) -> %.22 {
  233. // CHECK:STDOUT: !entry:
  234. // CHECK:STDOUT: %p.ref: %.18 = name_ref p, %p
  235. // CHECK:STDOUT: %.loc26_39.1: ref %B = deref %p.ref
  236. // CHECK:STDOUT: %.loc26_39.2: ref %A = class_element_access %.loc26_39.1, element0
  237. // CHECK:STDOUT: %.loc26_39.3: %.22 = addr_of %.loc26_39.2
  238. // CHECK:STDOUT: %.loc26_39.4: %.22 = converted %p.ref, %.loc26_39.3
  239. // CHECK:STDOUT: return %.loc26_39.4
  240. // CHECK:STDOUT: }
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: fn @ConvertCToA(%p.param_patt: %.17) -> %.22 {
  243. // CHECK:STDOUT: !entry:
  244. // CHECK:STDOUT: %p.ref: %.17 = name_ref p, %p
  245. // CHECK:STDOUT: %.loc27_39.1: ref %C = deref %p.ref
  246. // CHECK:STDOUT: %.loc27_39.2: ref %B = class_element_access %.loc27_39.1, element0
  247. // CHECK:STDOUT: %.loc27_39.3: ref %A = class_element_access %.loc27_39.2, element0
  248. // CHECK:STDOUT: %.loc27_39.4: %.22 = addr_of %.loc27_39.3
  249. // CHECK:STDOUT: %.loc27_39.5: %.22 = converted %p.ref, %.loc27_39.4
  250. // CHECK:STDOUT: return %.loc27_39.5
  251. // CHECK:STDOUT: }
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: fn @ConvertValue(%c.param_patt: %C) {
  254. // CHECK:STDOUT: !entry:
  255. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
  256. // CHECK:STDOUT: %c.ref: %C = name_ref c, %c
  257. // CHECK:STDOUT: %.loc30_15.1: ref %B = class_element_access %c.ref, element0
  258. // CHECK:STDOUT: %.loc30_15.2: ref %A = class_element_access %.loc30_15.1, element0
  259. // CHECK:STDOUT: %.loc30_15.3: ref %A = converted %c.ref, %.loc30_15.2
  260. // CHECK:STDOUT: %.loc30_15.4: %A = bind_value %.loc30_15.3
  261. // CHECK:STDOUT: %a: %A = bind_name a, %.loc30_15.4
  262. // CHECK:STDOUT: return
  263. // CHECK:STDOUT: }
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: fn @ConvertRef(%c.param_patt: %.17) -> %.22 {
  266. // CHECK:STDOUT: !entry:
  267. // CHECK:STDOUT: %c.ref: %.17 = name_ref c, %c
  268. // CHECK:STDOUT: %.loc34_12: ref %C = deref %c.ref
  269. // CHECK:STDOUT: %A.ref.loc34: type = name_ref A, file.%A.decl [template = constants.%A]
  270. // CHECK:STDOUT: %.loc34_15.1: ref %B = class_element_access %.loc34_12, element0
  271. // CHECK:STDOUT: %.loc34_15.2: ref %A = class_element_access %.loc34_15.1, element0
  272. // CHECK:STDOUT: %.loc34_15.3: ref %A = converted %.loc34_12, %.loc34_15.2
  273. // CHECK:STDOUT: %.loc34_10: %.22 = addr_of %.loc34_15.3
  274. // CHECK:STDOUT: return %.loc34_10
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: fn @ConvertInit() {
  278. // CHECK:STDOUT: !entry:
  279. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
  280. // CHECK:STDOUT: %.loc38_38: i32 = int_literal 1 [template = constants.%.23]
  281. // CHECK:STDOUT: %.loc38_39.1: %.3 = struct_literal (%.loc38_38)
  282. // CHECK:STDOUT: %.loc38_47: i32 = int_literal 2 [template = constants.%.24]
  283. // CHECK:STDOUT: %.loc38_48.1: %.25 = struct_literal (%.loc38_39.1, %.loc38_47)
  284. // CHECK:STDOUT: %.loc38_56: i32 = int_literal 3 [template = constants.%.26]
  285. // CHECK:STDOUT: %.loc38_57.1: %.27 = struct_literal (%.loc38_48.1, %.loc38_56)
  286. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  287. // CHECK:STDOUT: %.loc38_57.2: ref %C = temporary_storage
  288. // CHECK:STDOUT: %.loc38_57.3: ref %B = class_element_access %.loc38_57.2, element0
  289. // CHECK:STDOUT: %.loc38_48.2: ref %A = class_element_access %.loc38_57.3, element0
  290. // CHECK:STDOUT: %.loc38_39.2: ref i32 = class_element_access %.loc38_48.2, element0
  291. // CHECK:STDOUT: %.loc38_39.3: init i32 = initialize_from %.loc38_38 to %.loc38_39.2 [template = constants.%.23]
  292. // CHECK:STDOUT: %.loc38_39.4: init %A = class_init (%.loc38_39.3), %.loc38_48.2 [template = constants.%struct.1]
  293. // CHECK:STDOUT: %.loc38_48.3: init %A = converted %.loc38_39.1, %.loc38_39.4 [template = constants.%struct.1]
  294. // CHECK:STDOUT: %.loc38_48.4: ref i32 = class_element_access %.loc38_57.3, element1
  295. // CHECK:STDOUT: %.loc38_48.5: init i32 = initialize_from %.loc38_47 to %.loc38_48.4 [template = constants.%.24]
  296. // CHECK:STDOUT: %.loc38_48.6: init %B = class_init (%.loc38_48.3, %.loc38_48.5), %.loc38_57.3 [template = constants.%struct.2]
  297. // CHECK:STDOUT: %.loc38_57.4: init %B = converted %.loc38_48.1, %.loc38_48.6 [template = constants.%struct.2]
  298. // CHECK:STDOUT: %.loc38_57.5: ref i32 = class_element_access %.loc38_57.2, element1
  299. // CHECK:STDOUT: %.loc38_57.6: init i32 = initialize_from %.loc38_56 to %.loc38_57.5 [template = constants.%.26]
  300. // CHECK:STDOUT: %.loc38_57.7: init %C = class_init (%.loc38_57.4, %.loc38_57.6), %.loc38_57.2 [template = constants.%struct.3]
  301. // CHECK:STDOUT: %.loc38_57.8: ref %C = temporary %.loc38_57.2, %.loc38_57.7
  302. // CHECK:STDOUT: %.loc38_59: ref %C = converted %.loc38_57.1, %.loc38_57.8
  303. // CHECK:STDOUT: %.loc38_63.1: ref %B = class_element_access %.loc38_59, element0
  304. // CHECK:STDOUT: %.loc38_63.2: ref %A = class_element_access %.loc38_63.1, element0
  305. // CHECK:STDOUT: %.loc38_63.3: ref %A = converted %.loc38_59, %.loc38_63.2
  306. // CHECK:STDOUT: %.loc38_63.4: %A = bind_value %.loc38_63.3
  307. // CHECK:STDOUT: %a: %A = bind_name a, %.loc38_63.4
  308. // CHECK:STDOUT: return
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT: