base.carbon 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  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. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/primitives.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/class/base.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/class/base.carbon
  12. // --- derived_to_base_conversion.h
  13. class Base {};
  14. class Derived : public Base {};
  15. // --- use_derived_to_base_conversion.carbon
  16. library "[[@TEST_NAME]]";
  17. import Cpp library "derived_to_base_conversion.h";
  18. //@dump-sem-ir-begin
  19. fn ConvertPtr(d: Cpp.Derived*) -> Cpp.Base* {
  20. return d;
  21. }
  22. //@dump-sem-ir-end
  23. fn AcceptVal(b: Cpp.Base);
  24. //@dump-sem-ir-begin
  25. fn ConvertVal(d: Cpp.Derived) {
  26. AcceptVal(d);
  27. }
  28. //@dump-sem-ir-end
  29. // --- static_member.h
  30. class Base {
  31. public:
  32. static auto base_fn() -> void;
  33. };
  34. class Derived : public Base {
  35. public:
  36. static auto derived_fn() -> void;
  37. };
  38. // --- use_static_member.carbon
  39. library "[[@TEST_NAME]]";
  40. import Cpp library "static_member.h";
  41. fn MyF() {
  42. //@dump-sem-ir-begin
  43. Cpp.Base.base_fn();
  44. Cpp.Derived.base_fn();
  45. Cpp.Derived.derived_fn();
  46. //@dump-sem-ir-end
  47. }
  48. // --- base_field.h
  49. struct Base {
  50. int a;
  51. int b;
  52. };
  53. struct Derived : Base {
  54. int b;
  55. };
  56. // --- use_base_field.carbon
  57. library "[[@TEST_NAME]]";
  58. import Cpp library "base_field.h";
  59. fn AccessDirect(d: Cpp.Derived) -> i32 {
  60. //@dump-sem-ir-begin
  61. return d.a;
  62. //@dump-sem-ir-end
  63. }
  64. fn AccessQualified(d: Cpp.Derived) -> i32 {
  65. //@dump-sem-ir-begin
  66. return d.(Cpp.Base.b);
  67. //@dump-sem-ir-end
  68. }
  69. // --- base_method.h
  70. struct Base {
  71. void f() const;
  72. void g() const;
  73. };
  74. struct Derived : Base {
  75. void g() const;
  76. };
  77. // --- use_base_method.carbon
  78. library "[[@TEST_NAME]]";
  79. import Cpp library "base_method.h";
  80. fn CallDirect(d: Cpp.Derived) {
  81. //@dump-sem-ir-begin
  82. d.f();
  83. //@dump-sem-ir-end
  84. }
  85. fn CallQualified(d: Cpp.Derived) {
  86. //@dump-sem-ir-begin
  87. d.(Cpp.Base.g)();
  88. //@dump-sem-ir-end
  89. }
  90. // --- multiple_inheritance.h
  91. struct A { int a; };
  92. struct B { int b; };
  93. struct C : A, B {};
  94. struct Empty1 {};
  95. struct Empty2 {};
  96. struct OneNonEmptyBase : Empty1, A, Empty2 {};
  97. struct TwoNonEmptyBases : Empty1, A, B, Empty2 {};
  98. struct Polymorphic1 {
  99. virtual void f();
  100. };
  101. struct Polymorphic2 {
  102. virtual void g();
  103. };
  104. struct OnePolymorphicBase : A, B, Polymorphic1, Empty1 {};
  105. struct TwoPolymorphicBases : Polymorphic1, Polymorphic2 {};
  106. // --- fail_todo_use_multiple_inheritance.carbon
  107. library "[[@TEST_NAME]]";
  108. import Cpp library "multiple_inheritance.h";
  109. fn ConvertA(p: Cpp.C*) -> Cpp.A* {
  110. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.C*` to `Cpp.A*` [ConversionFailure]
  111. // CHECK:STDERR: return p;
  112. // CHECK:STDERR: ^~~~~~~~~
  113. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessNote]
  114. // CHECK:STDERR: return p;
  115. // CHECK:STDERR: ^~~~~~~~~
  116. // CHECK:STDERR:
  117. return p;
  118. }
  119. fn ConvertB(p: Cpp.C*) -> Cpp.B* {
  120. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.C*` to `Cpp.B*` [ConversionFailure]
  121. // CHECK:STDERR: return p;
  122. // CHECK:STDERR: ^~~~~~~~~
  123. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessNote]
  124. // CHECK:STDERR: return p;
  125. // CHECK:STDERR: ^~~~~~~~~
  126. // CHECK:STDERR:
  127. return p;
  128. }
  129. fn ConvertOneNonEmptyBaseToEmpty1(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty1* {
  130. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.OneNonEmptyBase*` to `Cpp.Empty1*` [ConversionFailure]
  131. // CHECK:STDERR: return p;
  132. // CHECK:STDERR: ^~~~~~~~~
  133. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty1*)` [MissingImplInMemberAccessNote]
  134. // CHECK:STDERR: return p;
  135. // CHECK:STDERR: ^~~~~~~~~
  136. // CHECK:STDERR:
  137. return p;
  138. }
  139. fn ConvertOneNonEmptyBaseToEmpty2(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty2* {
  140. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.OneNonEmptyBase*` to `Cpp.Empty2*` [ConversionFailure]
  141. // CHECK:STDERR: return p;
  142. // CHECK:STDERR: ^~~~~~~~~
  143. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty2*)` [MissingImplInMemberAccessNote]
  144. // CHECK:STDERR: return p;
  145. // CHECK:STDERR: ^~~~~~~~~
  146. // CHECK:STDERR:
  147. return p;
  148. }
  149. fn ConvertTwoNonEmptyBasesToA(p: Cpp.TwoNonEmptyBases*) -> Cpp.A* {
  150. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.TwoNonEmptyBases*` to `Cpp.A*` [ConversionFailure]
  151. // CHECK:STDERR: return p;
  152. // CHECK:STDERR: ^~~~~~~~~
  153. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessNote]
  154. // CHECK:STDERR: return p;
  155. // CHECK:STDERR: ^~~~~~~~~
  156. // CHECK:STDERR:
  157. return p;
  158. }
  159. fn ConvertTwoNonEmptyBasesToB(p: Cpp.TwoNonEmptyBases*) -> Cpp.B* {
  160. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.TwoNonEmptyBases*` to `Cpp.B*` [ConversionFailure]
  161. // CHECK:STDERR: return p;
  162. // CHECK:STDERR: ^~~~~~~~~
  163. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessNote]
  164. // CHECK:STDERR: return p;
  165. // CHECK:STDERR: ^~~~~~~~~
  166. // CHECK:STDERR:
  167. return p;
  168. }
  169. fn ConvertOnePolymorphicBaseToA(p: Cpp.OnePolymorphicBase*) -> Cpp.A* {
  170. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.OnePolymorphicBase*` to `Cpp.A*` [ConversionFailure]
  171. // CHECK:STDERR: return p;
  172. // CHECK:STDERR: ^~~~~~~~~
  173. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessNote]
  174. // CHECK:STDERR: return p;
  175. // CHECK:STDERR: ^~~~~~~~~
  176. // CHECK:STDERR:
  177. return p;
  178. }
  179. fn ConvertOnePolymorphicBaseToB(p: Cpp.OnePolymorphicBase*) -> Cpp.B* {
  180. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.OnePolymorphicBase*` to `Cpp.B*` [ConversionFailure]
  181. // CHECK:STDERR: return p;
  182. // CHECK:STDERR: ^~~~~~~~~
  183. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessNote]
  184. // CHECK:STDERR: return p;
  185. // CHECK:STDERR: ^~~~~~~~~
  186. // CHECK:STDERR:
  187. return p;
  188. }
  189. fn ConvertTwoPolymorphicBasesToPolymorphic1(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic1* {
  190. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.TwoPolymorphicBases*` to `Cpp.Polymorphic1*` [ConversionFailure]
  191. // CHECK:STDERR: return p;
  192. // CHECK:STDERR: ^~~~~~~~~
  193. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic1*)` [MissingImplInMemberAccessNote]
  194. // CHECK:STDERR: return p;
  195. // CHECK:STDERR: ^~~~~~~~~
  196. // CHECK:STDERR:
  197. return p;
  198. }
  199. fn ConvertTwoPolymorphicBasesToPolymorphic2(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic2* {
  200. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.TwoPolymorphicBases*` to `Cpp.Polymorphic2*` [ConversionFailure]
  201. // CHECK:STDERR: return p;
  202. // CHECK:STDERR: ^~~~~~~~~
  203. // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic2*)` [MissingImplInMemberAccessNote]
  204. // CHECK:STDERR: return p;
  205. // CHECK:STDERR: ^~~~~~~~~
  206. // CHECK:STDERR:
  207. return p;
  208. }
  209. // --- multiple_inheritance_with_preferred_base.carbon
  210. library "[[@TEST_NAME]]";
  211. import Cpp library "multiple_inheritance.h";
  212. // If there's only one non-empty base, that's our preferred base class. We can
  213. // convert to that.
  214. fn ConvertOneNonEmptyBaseToA(p: Cpp.OneNonEmptyBase*) -> Cpp.A* {
  215. return p;
  216. }
  217. // If there's only one polymorphic base, that's our preferred base class. We can
  218. // convert to that.
  219. fn ConvertOnePolymorphicBaseToPolymorphic1(p: Cpp.OnePolymorphicBase*) -> Cpp.Polymorphic1* {
  220. return p;
  221. }
  222. // --- virtual_inheritance.h
  223. struct A { int a; };
  224. struct B : virtual A {};
  225. void UseB(B * _Nonnull p);
  226. // --- use_virtual_inheritance_incomplete.carbon
  227. library "[[@TEST_NAME]]";
  228. import Cpp library "virtual_inheritance.h";
  229. fn Convert(p: Cpp.B*) {
  230. // OK, doesn't require `Cpp.B` to be a complete type.
  231. Cpp.UseB(p);
  232. }
  233. // --- fail_todo_use_virtual_inheritance.carbon
  234. library "[[@TEST_NAME]]";
  235. import Cpp library "virtual_inheritance.h";
  236. fn Convert(p: Cpp.B*) -> Cpp.A* {
  237. // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+21]]:3: error: semantics TODO: `class with virtual bases` [SemanticsTodo]
  238. // CHECK:STDERR: return p;
  239. // CHECK:STDERR: ^~~~~~~~~
  240. // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+18]]:3: note: while completing C++ type `Cpp.B` [InCppTypeCompletion]
  241. // CHECK:STDERR: return p;
  242. // CHECK:STDERR: ^~~~~~~~~
  243. // CHECK:STDERR:
  244. // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+14]]:3: error: semantics TODO: `class with virtual bases` [SemanticsTodo]
  245. // CHECK:STDERR: return p;
  246. // CHECK:STDERR: ^~~~~~~~~
  247. // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+11]]:3: note: while completing C++ type `Cpp.B` [InCppTypeCompletion]
  248. // CHECK:STDERR: return p;
  249. // CHECK:STDERR: ^~~~~~~~~
  250. // CHECK:STDERR:
  251. // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.B*` to `Cpp.A*` [ConversionFailure]
  252. // CHECK:STDERR: return p;
  253. // CHECK:STDERR: ^~~~~~~~~
  254. // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.B*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessNote]
  255. // CHECK:STDERR: return p;
  256. // CHECK:STDERR: ^~~~~~~~~
  257. // CHECK:STDERR:
  258. return p;
  259. }
  260. // --- final.h
  261. struct A final {};
  262. // --- fail_derive_from_final.carbon
  263. library "[[@TEST_NAME]]";
  264. import Cpp library "final.h";
  265. class B {
  266. // CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+4]]:16: error: deriving from final type `A`; base type must be an `abstract` or `base` class [BaseIsFinal]
  267. // CHECK:STDERR: extend base: Cpp.A;
  268. // CHECK:STDERR: ^~~~~
  269. // CHECK:STDERR:
  270. extend base: Cpp.A;
  271. }
  272. // --- union.h
  273. union U {};
  274. // --- fail_derive_from_union.carbon
  275. library "[[@TEST_NAME]]";
  276. import Cpp library "union.h";
  277. class V {
  278. // CHECK:STDERR: fail_derive_from_union.carbon:[[@LINE+4]]:16: error: deriving from final type `U`; base type must be an `abstract` or `base` class [BaseIsFinal]
  279. // CHECK:STDERR: extend base: Cpp.U;
  280. // CHECK:STDERR: ^~~~~
  281. // CHECK:STDERR:
  282. extend base: Cpp.U;
  283. }
  284. // CHECK:STDOUT: --- use_derived_to_base_conversion.carbon
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: constants {
  287. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  288. // CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
  289. // CHECK:STDOUT: %ptr.ddb: type = ptr_type %Derived [concrete]
  290. // CHECK:STDOUT: %pattern_type.5c8: type = pattern_type %ptr.ddb [concrete]
  291. // CHECK:STDOUT: %Base: type = class_type @Base [concrete]
  292. // CHECK:STDOUT: %ptr.fb2: type = ptr_type %Base [concrete]
  293. // CHECK:STDOUT: %pattern_type.72a: type = pattern_type %ptr.fb2 [concrete]
  294. // CHECK:STDOUT: %ConvertPtr.type: type = fn_type @ConvertPtr [concrete]
  295. // CHECK:STDOUT: %ConvertPtr: %ConvertPtr.type = struct_value () [concrete]
  296. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  297. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  298. // CHECK:STDOUT: %T.d9f: type = symbolic_binding T, 0 [symbolic]
  299. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.75b: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%T.d9f) [symbolic]
  300. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.692: %ptr.as.Copy.impl.Op.type.75b = struct_value () [symbolic]
  301. // CHECK:STDOUT: %Copy.impl_witness.dec: <witness> = impl_witness imports.%Copy.impl_witness_table.67d, @ptr.as.Copy.impl(%Base) [concrete]
  302. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.9d2: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%Base) [concrete]
  303. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.ba1: %ptr.as.Copy.impl.Op.type.9d2 = struct_value () [concrete]
  304. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %ptr.fb2, (%Copy.impl_witness.dec) [concrete]
  305. // CHECK:STDOUT: %.30c: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
  306. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %ptr.as.Copy.impl.Op.ba1, @ptr.as.Copy.impl.Op(%Base) [concrete]
  307. // CHECK:STDOUT: %AcceptVal.type: type = fn_type @AcceptVal [concrete]
  308. // CHECK:STDOUT: %AcceptVal: %AcceptVal.type = struct_value () [concrete]
  309. // CHECK:STDOUT: %pattern_type.5de: type = pattern_type %Derived [concrete]
  310. // CHECK:STDOUT: %ConvertVal.type: type = fn_type @ConvertVal [concrete]
  311. // CHECK:STDOUT: %ConvertVal: %ConvertVal.type = struct_value () [concrete]
  312. // CHECK:STDOUT: }
  313. // CHECK:STDOUT:
  314. // CHECK:STDOUT: imports {
  315. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  316. // CHECK:STDOUT: .Derived = %Derived.decl
  317. // CHECK:STDOUT: .Base = %Base.decl
  318. // CHECK:STDOUT: import Cpp//...
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [concrete = constants.%Derived] {} {}
  321. // CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {}
  322. // CHECK:STDOUT: %Core.import_ref.659: @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op.type (%ptr.as.Copy.impl.Op.type.75b) = import_ref Core//prelude/parts/copy, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op (constants.%ptr.as.Copy.impl.Op.692)]
  323. // CHECK:STDOUT: %Copy.impl_witness_table.67d = impl_witness_table (%Core.import_ref.659), @ptr.as.Copy.impl [concrete]
  324. // CHECK:STDOUT: }
  325. // CHECK:STDOUT:
  326. // CHECK:STDOUT: file {
  327. // CHECK:STDOUT: %ConvertPtr.decl: %ConvertPtr.type = fn_decl @ConvertPtr [concrete = constants.%ConvertPtr] {
  328. // CHECK:STDOUT: %d.patt: %pattern_type.5c8 = value_binding_pattern d [concrete]
  329. // CHECK:STDOUT: %d.param_patt: %pattern_type.5c8 = value_param_pattern %d.patt, call_param0 [concrete]
  330. // CHECK:STDOUT: %return.patt: %pattern_type.72a = return_slot_pattern [concrete]
  331. // CHECK:STDOUT: %return.param_patt: %pattern_type.72a = out_param_pattern %return.patt, call_param1 [concrete]
  332. // CHECK:STDOUT: } {
  333. // CHECK:STDOUT: %Cpp.ref.loc7_35: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  334. // CHECK:STDOUT: %Base.ref: type = name_ref Base, imports.%Base.decl [concrete = constants.%Base]
  335. // CHECK:STDOUT: %ptr.loc7_43: type = ptr_type %Base.ref [concrete = constants.%ptr.fb2]
  336. // CHECK:STDOUT: %d.param: %ptr.ddb = value_param call_param0
  337. // CHECK:STDOUT: %.loc7: type = splice_block %ptr.loc7_29 [concrete = constants.%ptr.ddb] {
  338. // CHECK:STDOUT: %Cpp.ref.loc7_18: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  339. // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, imports.%Derived.decl [concrete = constants.%Derived]
  340. // CHECK:STDOUT: %ptr.loc7_29: type = ptr_type %Derived.ref [concrete = constants.%ptr.ddb]
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT: %d: %ptr.ddb = value_binding d, %d.param
  343. // CHECK:STDOUT: %return.param: ref %ptr.fb2 = out_param call_param1
  344. // CHECK:STDOUT: %return: ref %ptr.fb2 = return_slot %return.param
  345. // CHECK:STDOUT: }
  346. // CHECK:STDOUT: %ConvertVal.decl: %ConvertVal.type = fn_decl @ConvertVal [concrete = constants.%ConvertVal] {
  347. // CHECK:STDOUT: %d.patt: %pattern_type.5de = value_binding_pattern d [concrete]
  348. // CHECK:STDOUT: %d.param_patt: %pattern_type.5de = value_param_pattern %d.patt, call_param0 [concrete]
  349. // CHECK:STDOUT: } {
  350. // CHECK:STDOUT: %d.param: %Derived = value_param call_param0
  351. // CHECK:STDOUT: %.loc15: type = splice_block %Derived.ref [concrete = constants.%Derived] {
  352. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  353. // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, imports.%Derived.decl [concrete = constants.%Derived]
  354. // CHECK:STDOUT: }
  355. // CHECK:STDOUT: %d: %Derived = value_binding d, %d.param
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT: }
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: fn @ConvertPtr(%d.param: %ptr.ddb) -> %ptr.fb2 {
  360. // CHECK:STDOUT: !entry:
  361. // CHECK:STDOUT: %d.ref: %ptr.ddb = name_ref d, %d
  362. // CHECK:STDOUT: %.loc8_11.1: ref %Derived = deref %d.ref
  363. // CHECK:STDOUT: %.loc8_11.2: ref %Base = class_element_access %.loc8_11.1, element0
  364. // CHECK:STDOUT: %addr: %ptr.fb2 = addr_of %.loc8_11.2
  365. // CHECK:STDOUT: %.loc8_11.3: %ptr.fb2 = converted %d.ref, %addr
  366. // CHECK:STDOUT: %impl.elem0: %.30c = impl_witness_access constants.%Copy.impl_witness.dec, element0 [concrete = constants.%ptr.as.Copy.impl.Op.ba1]
  367. // CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %.loc8_11.3, %impl.elem0
  368. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @ptr.as.Copy.impl.Op(constants.%Base) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn]
  369. // CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %.loc8_11.3, %specific_fn
  370. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.call: init %ptr.fb2 = call %bound_method.loc8_11.2(%.loc8_11.3)
  371. // CHECK:STDOUT: return %ptr.as.Copy.impl.Op.call to %return
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT:
  374. // CHECK:STDOUT: fn @ConvertVal(%d.param: %Derived) {
  375. // CHECK:STDOUT: !entry:
  376. // CHECK:STDOUT: %AcceptVal.ref: %AcceptVal.type = name_ref AcceptVal, file.%AcceptVal.decl [concrete = constants.%AcceptVal]
  377. // CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
  378. // CHECK:STDOUT: %.loc16_13.1: ref %Base = class_element_access %d.ref, element0
  379. // CHECK:STDOUT: %.loc16_13.2: ref %Base = converted %d.ref, %.loc16_13.1
  380. // CHECK:STDOUT: %.loc16_13.3: %Base = acquire_value %.loc16_13.2
  381. // CHECK:STDOUT: %AcceptVal.call: init %empty_tuple.type = call %AcceptVal.ref(%.loc16_13.3)
  382. // CHECK:STDOUT: return
  383. // CHECK:STDOUT: }
  384. // CHECK:STDOUT:
  385. // CHECK:STDOUT: --- use_static_member.carbon
  386. // CHECK:STDOUT:
  387. // CHECK:STDOUT: constants {
  388. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  389. // CHECK:STDOUT: %Base: type = class_type @Base [concrete]
  390. // CHECK:STDOUT: %Base.base_fn.cpp_overload_set.type: type = cpp_overload_set_type @Base.base_fn.cpp_overload_set [concrete]
  391. // CHECK:STDOUT: %Base.base_fn.cpp_overload_set.value: %Base.base_fn.cpp_overload_set.type = cpp_overload_set_value @Base.base_fn.cpp_overload_set [concrete]
  392. // CHECK:STDOUT: %Base.base_fn.type: type = fn_type @Base.base_fn [concrete]
  393. // CHECK:STDOUT: %Base.base_fn: %Base.base_fn.type = struct_value () [concrete]
  394. // CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
  395. // CHECK:STDOUT: %Derived.base_fn.cpp_overload_set.type: type = cpp_overload_set_type @Derived.base_fn.cpp_overload_set [concrete]
  396. // CHECK:STDOUT: %Derived.base_fn.cpp_overload_set.value: %Derived.base_fn.cpp_overload_set.type = cpp_overload_set_value @Derived.base_fn.cpp_overload_set [concrete]
  397. // CHECK:STDOUT: %Derived.derived_fn.cpp_overload_set.type: type = cpp_overload_set_type @Derived.derived_fn.cpp_overload_set [concrete]
  398. // CHECK:STDOUT: %Derived.derived_fn.cpp_overload_set.value: %Derived.derived_fn.cpp_overload_set.type = cpp_overload_set_value @Derived.derived_fn.cpp_overload_set [concrete]
  399. // CHECK:STDOUT: %Derived.derived_fn.type: type = fn_type @Derived.derived_fn [concrete]
  400. // CHECK:STDOUT: %Derived.derived_fn: %Derived.derived_fn.type = struct_value () [concrete]
  401. // CHECK:STDOUT: }
  402. // CHECK:STDOUT:
  403. // CHECK:STDOUT: imports {
  404. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  405. // CHECK:STDOUT: .Base = %Base.decl
  406. // CHECK:STDOUT: .Derived = %Derived.decl
  407. // CHECK:STDOUT: import Cpp//...
  408. // CHECK:STDOUT: }
  409. // CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {}
  410. // CHECK:STDOUT: %Base.base_fn.cpp_overload_set.value: %Base.base_fn.cpp_overload_set.type = cpp_overload_set_value @Base.base_fn.cpp_overload_set [concrete = constants.%Base.base_fn.cpp_overload_set.value]
  411. // CHECK:STDOUT: %Base.base_fn.decl: %Base.base_fn.type = fn_decl @Base.base_fn [concrete = constants.%Base.base_fn] {} {}
  412. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [concrete = constants.%Derived] {} {}
  413. // CHECK:STDOUT: %Derived.base_fn.cpp_overload_set.value: %Derived.base_fn.cpp_overload_set.type = cpp_overload_set_value @Derived.base_fn.cpp_overload_set [concrete = constants.%Derived.base_fn.cpp_overload_set.value]
  414. // CHECK:STDOUT: %Derived.derived_fn.cpp_overload_set.value: %Derived.derived_fn.cpp_overload_set.type = cpp_overload_set_value @Derived.derived_fn.cpp_overload_set [concrete = constants.%Derived.derived_fn.cpp_overload_set.value]
  415. // CHECK:STDOUT: %Derived.derived_fn.decl: %Derived.derived_fn.type = fn_decl @Derived.derived_fn [concrete = constants.%Derived.derived_fn] {} {}
  416. // CHECK:STDOUT: }
  417. // CHECK:STDOUT:
  418. // CHECK:STDOUT: fn @MyF() {
  419. // CHECK:STDOUT: !entry:
  420. // CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  421. // CHECK:STDOUT: %Base.ref: type = name_ref Base, imports.%Base.decl [concrete = constants.%Base]
  422. // CHECK:STDOUT: %base_fn.ref.loc8: %Base.base_fn.cpp_overload_set.type = name_ref base_fn, imports.%Base.base_fn.cpp_overload_set.value [concrete = constants.%Base.base_fn.cpp_overload_set.value]
  423. // CHECK:STDOUT: %Base.base_fn.call.loc8: init %empty_tuple.type = call imports.%Base.base_fn.decl()
  424. // CHECK:STDOUT: %Cpp.ref.loc9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  425. // CHECK:STDOUT: %Derived.ref.loc9: type = name_ref Derived, imports.%Derived.decl [concrete = constants.%Derived]
  426. // CHECK:STDOUT: %base_fn.ref.loc9: %Derived.base_fn.cpp_overload_set.type = name_ref base_fn, imports.%Derived.base_fn.cpp_overload_set.value [concrete = constants.%Derived.base_fn.cpp_overload_set.value]
  427. // CHECK:STDOUT: %Base.base_fn.call.loc9: init %empty_tuple.type = call imports.%Base.base_fn.decl()
  428. // CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  429. // CHECK:STDOUT: %Derived.ref.loc10: type = name_ref Derived, imports.%Derived.decl [concrete = constants.%Derived]
  430. // CHECK:STDOUT: %derived_fn.ref: %Derived.derived_fn.cpp_overload_set.type = name_ref derived_fn, imports.%Derived.derived_fn.cpp_overload_set.value [concrete = constants.%Derived.derived_fn.cpp_overload_set.value]
  431. // CHECK:STDOUT: %Derived.derived_fn.call: init %empty_tuple.type = call imports.%Derived.derived_fn.decl()
  432. // CHECK:STDOUT: <elided>
  433. // CHECK:STDOUT: }
  434. // CHECK:STDOUT:
  435. // CHECK:STDOUT: --- use_base_field.carbon
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: constants {
  438. // CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
  439. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  440. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  441. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  442. // CHECK:STDOUT: %Base: type = class_type @Base [concrete]
  443. // CHECK:STDOUT: %Base.elem: type = unbound_element_type %Base, %i32 [concrete]
  444. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  445. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  446. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.24b: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
  447. // CHECK:STDOUT: %Int.as.Copy.impl.Op.c95: %Int.as.Copy.impl.Op.type.24b = struct_value () [symbolic]
  448. // CHECK:STDOUT: %Copy.impl_witness.fb7: <witness> = impl_witness imports.%Copy.impl_witness_table.b6a, @Int.as.Copy.impl(%int_32) [concrete]
  449. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.469: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete]
  450. // CHECK:STDOUT: %Int.as.Copy.impl.Op.dfd: %Int.as.Copy.impl.Op.type.469 = struct_value () [concrete]
  451. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i32, (%Copy.impl_witness.fb7) [concrete]
  452. // CHECK:STDOUT: %.65f: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
  453. // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Copy.impl.Op.dfd, @Int.as.Copy.impl.Op(%int_32) [concrete]
  454. // CHECK:STDOUT: }
  455. // CHECK:STDOUT:
  456. // CHECK:STDOUT: imports {
  457. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  458. // CHECK:STDOUT: .Derived = %Derived.decl
  459. // CHECK:STDOUT: .Base = %Base.decl
  460. // CHECK:STDOUT: import Cpp//...
  461. // CHECK:STDOUT: }
  462. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [concrete = constants.%Derived] {} {}
  463. // CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {}
  464. // CHECK:STDOUT: %Core.import_ref.d12: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.24b) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.c95)]
  465. // CHECK:STDOUT: %Copy.impl_witness_table.b6a = impl_witness_table (%Core.import_ref.d12), @Int.as.Copy.impl [concrete]
  466. // CHECK:STDOUT: }
  467. // CHECK:STDOUT:
  468. // CHECK:STDOUT: fn @AccessDirect(%d.param: %Derived) -> %i32 {
  469. // CHECK:STDOUT: !entry:
  470. // CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
  471. // CHECK:STDOUT: %a.ref: %Base.elem = name_ref a, @Base.%.1 [concrete = @Base.%.1]
  472. // CHECK:STDOUT: %.loc8_11.1: ref %Base = class_element_access %d.ref, element0
  473. // CHECK:STDOUT: %.loc8_11.2: ref %Base = converted %d.ref, %.loc8_11.1
  474. // CHECK:STDOUT: %.loc8_11.3: ref %i32 = class_element_access %.loc8_11.2, element0
  475. // CHECK:STDOUT: %.loc8_11.4: %i32 = acquire_value %.loc8_11.3
  476. // CHECK:STDOUT: %impl.elem0: %.65f = impl_witness_access constants.%Copy.impl_witness.fb7, element0 [concrete = constants.%Int.as.Copy.impl.Op.dfd]
  477. // CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %.loc8_11.4, %impl.elem0
  478. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  479. // CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %.loc8_11.4, %specific_fn
  480. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc8_11.2(%.loc8_11.4)
  481. // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return
  482. // CHECK:STDOUT: }
  483. // CHECK:STDOUT:
  484. // CHECK:STDOUT: fn @AccessQualified(%d.param: %Derived) -> %i32 {
  485. // CHECK:STDOUT: !entry:
  486. // CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
  487. // CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  488. // CHECK:STDOUT: %Base.ref: type = name_ref Base, imports.%Base.decl [concrete = constants.%Base]
  489. // CHECK:STDOUT: %b.ref: %Base.elem = name_ref b, @Base.%.2 [concrete = @Base.%.2]
  490. // CHECK:STDOUT: %.loc14_11.1: ref %Base = class_element_access %d.ref, element0
  491. // CHECK:STDOUT: %.loc14_11.2: ref %Base = converted %d.ref, %.loc14_11.1
  492. // CHECK:STDOUT: %.loc14_11.3: ref %i32 = class_element_access %.loc14_11.2, element1
  493. // CHECK:STDOUT: %.loc14_11.4: %i32 = acquire_value %.loc14_11.3
  494. // CHECK:STDOUT: %impl.elem0: %.65f = impl_witness_access constants.%Copy.impl_witness.fb7, element0 [concrete = constants.%Int.as.Copy.impl.Op.dfd]
  495. // CHECK:STDOUT: %bound_method.loc14_11.1: <bound method> = bound_method %.loc14_11.4, %impl.elem0
  496. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  497. // CHECK:STDOUT: %bound_method.loc14_11.2: <bound method> = bound_method %.loc14_11.4, %specific_fn
  498. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc14_11.2(%.loc14_11.4)
  499. // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return
  500. // CHECK:STDOUT: }
  501. // CHECK:STDOUT:
  502. // CHECK:STDOUT: --- use_base_method.carbon
  503. // CHECK:STDOUT:
  504. // CHECK:STDOUT: constants {
  505. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  506. // CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
  507. // CHECK:STDOUT: %Base: type = class_type @Base [concrete]
  508. // CHECK:STDOUT: %Derived.f.cpp_overload_set.type: type = cpp_overload_set_type @Derived.f.cpp_overload_set [concrete]
  509. // CHECK:STDOUT: %Derived.f.cpp_overload_set.value: %Derived.f.cpp_overload_set.type = cpp_overload_set_value @Derived.f.cpp_overload_set [concrete]
  510. // CHECK:STDOUT: %f__carbon_thunk.type: type = fn_type @f__carbon_thunk [concrete]
  511. // CHECK:STDOUT: %f__carbon_thunk: %f__carbon_thunk.type = struct_value () [concrete]
  512. // CHECK:STDOUT: %Base.g.cpp_overload_set.type: type = cpp_overload_set_type @Base.g.cpp_overload_set [concrete]
  513. // CHECK:STDOUT: %Base.g.cpp_overload_set.value: %Base.g.cpp_overload_set.type = cpp_overload_set_value @Base.g.cpp_overload_set [concrete]
  514. // CHECK:STDOUT: %g__carbon_thunk.type: type = fn_type @g__carbon_thunk [concrete]
  515. // CHECK:STDOUT: %g__carbon_thunk: %g__carbon_thunk.type = struct_value () [concrete]
  516. // CHECK:STDOUT: }
  517. // CHECK:STDOUT:
  518. // CHECK:STDOUT: imports {
  519. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  520. // CHECK:STDOUT: .Derived = %Derived.decl
  521. // CHECK:STDOUT: .Base = %Base.decl
  522. // CHECK:STDOUT: import Cpp//...
  523. // CHECK:STDOUT: }
  524. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [concrete = constants.%Derived] {} {}
  525. // CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {}
  526. // CHECK:STDOUT: %Derived.f.cpp_overload_set.value: %Derived.f.cpp_overload_set.type = cpp_overload_set_value @Derived.f.cpp_overload_set [concrete = constants.%Derived.f.cpp_overload_set.value]
  527. // CHECK:STDOUT: %f__carbon_thunk.decl: %f__carbon_thunk.type = fn_decl @f__carbon_thunk [concrete = constants.%f__carbon_thunk] {
  528. // CHECK:STDOUT: <elided>
  529. // CHECK:STDOUT: } {
  530. // CHECK:STDOUT: <elided>
  531. // CHECK:STDOUT: }
  532. // CHECK:STDOUT: %Base.g.cpp_overload_set.value: %Base.g.cpp_overload_set.type = cpp_overload_set_value @Base.g.cpp_overload_set [concrete = constants.%Base.g.cpp_overload_set.value]
  533. // CHECK:STDOUT: %g__carbon_thunk.decl: %g__carbon_thunk.type = fn_decl @g__carbon_thunk [concrete = constants.%g__carbon_thunk] {
  534. // CHECK:STDOUT: <elided>
  535. // CHECK:STDOUT: } {
  536. // CHECK:STDOUT: <elided>
  537. // CHECK:STDOUT: }
  538. // CHECK:STDOUT: }
  539. // CHECK:STDOUT:
  540. // CHECK:STDOUT: fn @CallDirect(%d.param: %Derived) {
  541. // CHECK:STDOUT: !entry:
  542. // CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
  543. // CHECK:STDOUT: %f.ref: %Derived.f.cpp_overload_set.type = name_ref f, imports.%Derived.f.cpp_overload_set.value [concrete = constants.%Derived.f.cpp_overload_set.value]
  544. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %d.ref, %f.ref
  545. // CHECK:STDOUT: %.loc8_3.1: ref %Base = class_element_access %d.ref, element0
  546. // CHECK:STDOUT: %.loc8_3.2: ref %Base = converted %d.ref, %.loc8_3.1
  547. // CHECK:STDOUT: %.loc8_3.3: %Base = acquire_value %.loc8_3.2
  548. // CHECK:STDOUT: %f__carbon_thunk.call: init %empty_tuple.type = call imports.%f__carbon_thunk.decl(%.loc8_3.3)
  549. // CHECK:STDOUT: <elided>
  550. // CHECK:STDOUT: }
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: fn @CallQualified(%d.param: %Derived) {
  553. // CHECK:STDOUT: !entry:
  554. // CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
  555. // CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  556. // CHECK:STDOUT: %Base.ref: type = name_ref Base, imports.%Base.decl [concrete = constants.%Base]
  557. // CHECK:STDOUT: %g.ref: %Base.g.cpp_overload_set.type = name_ref g, imports.%Base.g.cpp_overload_set.value [concrete = constants.%Base.g.cpp_overload_set.value]
  558. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %d.ref, %g.ref
  559. // CHECK:STDOUT: %.loc14_3.1: ref %Base = class_element_access %d.ref, element0
  560. // CHECK:STDOUT: %.loc14_3.2: ref %Base = converted %d.ref, %.loc14_3.1
  561. // CHECK:STDOUT: %.loc14_3.3: %Base = acquire_value %.loc14_3.2
  562. // CHECK:STDOUT: %g__carbon_thunk.call: init %empty_tuple.type = call imports.%g__carbon_thunk.decl(%.loc14_3.3)
  563. // CHECK:STDOUT: <elided>
  564. // CHECK:STDOUT: }
  565. // CHECK:STDOUT: