1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -S -triple x86_64-none-linux-gnu -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc struct S {
SS4*f4a2713aSLionel Sambuc S(int x) { }
SS5*f4a2713aSLionel Sambuc S(int x, double y, double z) { }
6*f4a2713aSLionel Sambuc };
7*f4a2713aSLionel Sambuc
fn1()8*f4a2713aSLionel Sambuc void fn1() {
9*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_Z3fn1v
10*f4a2713aSLionel Sambuc S s { 1 };
11*f4a2713aSLionel Sambuc // CHECK: alloca %struct.S, align 1
12*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1SC1Ei(%struct.S* %s, i32 1)
13*f4a2713aSLionel Sambuc }
14*f4a2713aSLionel Sambuc
fn2()15*f4a2713aSLionel Sambuc void fn2() {
16*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_Z3fn2v
17*f4a2713aSLionel Sambuc S s { 1, 2.0, 3.0 };
18*f4a2713aSLionel Sambuc // CHECK: alloca %struct.S, align 1
19*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1SC1Eidd(%struct.S* %s, i32 1, double 2.000000e+00, double 3.000000e+00)
20*f4a2713aSLionel Sambuc }
21*f4a2713aSLionel Sambuc
fn3()22*f4a2713aSLionel Sambuc void fn3() {
23*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_Z3fn3v
24*f4a2713aSLionel Sambuc S sa[] { { 1 }, { 2 }, { 3 } };
25*f4a2713aSLionel Sambuc // CHECK: alloca [3 x %struct.S], align 1
26*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1SC1Ei(%struct.S* %{{.+}}, i32 1)
27*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1SC1Ei(%struct.S* %{{.+}}, i32 2)
28*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1SC1Ei(%struct.S* %{{.+}}, i32 3)
29*f4a2713aSLionel Sambuc }
30*f4a2713aSLionel Sambuc
fn4()31*f4a2713aSLionel Sambuc void fn4() {
32*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_Z3fn4v
33*f4a2713aSLionel Sambuc S sa[] { { 1, 2.0, 3.0 }, { 4, 5.0, 6.0 } };
34*f4a2713aSLionel Sambuc // CHECK: alloca [2 x %struct.S], align 1
35*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1SC1Eidd(%struct.S* %{{.+}}, i32 1, double 2.000000e+00, double 3.000000e+00)
36*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1SC1Eidd(%struct.S* %{{.+}}, i32 4, double 5.000000e+00, double 6.000000e+00)
37*f4a2713aSLionel Sambuc }
38*f4a2713aSLionel Sambuc
39*f4a2713aSLionel Sambuc namespace TreeTransformBracedInit {
40*f4a2713aSLionel Sambuc struct S {};
41*f4a2713aSLionel Sambuc struct T { T(const S &); T(const T&); ~T(); };
42*f4a2713aSLionel Sambuc void x(const T &);
foo(const S & s)43*f4a2713aSLionel Sambuc template<typename> void foo(const S &s) {
44*f4a2713aSLionel Sambuc // Instantiation of this expression used to lose the CXXBindTemporaryExpr
45*f4a2713aSLionel Sambuc // node and thus not destroy the temporary.
46*f4a2713aSLionel Sambuc x({s});
47*f4a2713aSLionel Sambuc }
48*f4a2713aSLionel Sambuc template void foo<void>(const S&);
49*f4a2713aSLionel Sambuc // CHECK: define {{.*}} void @_ZN23TreeTransformBracedInit3fooIvEEvRKNS_1SE(
50*f4a2713aSLionel Sambuc // CHECK: call void @_ZN23TreeTransformBracedInit1TC1ERKNS_1SE(
51*f4a2713aSLionel Sambuc // CHECK-NEXT: call void @_ZN23TreeTransformBracedInit1xERKNS_1TE(
52*f4a2713aSLionel Sambuc // CHECK-NEXT: call void @_ZN23TreeTransformBracedInit1TD1Ev(
53*f4a2713aSLionel Sambuc }
54