xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/instantiate-temporaries.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc struct X {
4*f4a2713aSLionel Sambuc   X();
5*f4a2713aSLionel Sambuc   ~X();
6*f4a2713aSLionel Sambuc };
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc struct Y {
9*f4a2713aSLionel Sambuc   X get();
10*f4a2713aSLionel Sambuc };
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc struct X2 {
13*f4a2713aSLionel Sambuc   X x;
14*f4a2713aSLionel Sambuc };
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc template<typename T>
call()17*f4a2713aSLionel Sambuc void call() {
18*f4a2713aSLionel Sambuc   Y().get();
19*f4a2713aSLionel Sambuc }
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc // CHECK-LABEL: define weak_odr void @_Z4callIiEvv
22*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1Y3getEv
23*f4a2713aSLionel Sambuc // CHECK-NEXT: call void @_ZN1XD1Ev
24*f4a2713aSLionel Sambuc // CHECK-NEXT: ret void
25*f4a2713aSLionel Sambuc template void call<int>();
26*f4a2713aSLionel Sambuc 
27*f4a2713aSLionel Sambuc template<typename T>
compound_literal()28*f4a2713aSLionel Sambuc void compound_literal() {
29*f4a2713aSLionel Sambuc   (X2){};
30*f4a2713aSLionel Sambuc }
31*f4a2713aSLionel Sambuc 
32*f4a2713aSLionel Sambuc // CHECK-LABEL: define weak_odr void @_Z16compound_literalIiEvv
33*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1XC1Ev
34*f4a2713aSLionel Sambuc // CHECK-NEXT: call void @_ZN2X2D1Ev
35*f4a2713aSLionel Sambuc // CHECK-NEXT: ret void
36*f4a2713aSLionel Sambuc template void compound_literal<int>();
37*f4a2713aSLionel Sambuc 
38