1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc // PR5484 4*f4a2713aSLionel Sambuc namespace PR5484 { 5*f4a2713aSLionel Sambuc struct A { }; 6*f4a2713aSLionel Sambuc extern A a; 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc void f(const A & = a); 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc void g() { 11*f4a2713aSLionel Sambuc f(); 12*f4a2713aSLionel Sambuc } 13*f4a2713aSLionel Sambuc } 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambuc struct A1 { 16*f4a2713aSLionel Sambuc A1(); 17*f4a2713aSLionel Sambuc ~A1(); 18*f4a2713aSLionel Sambuc }; 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambuc struct A2 { 21*f4a2713aSLionel Sambuc A2(); 22*f4a2713aSLionel Sambuc ~A2(); 23*f4a2713aSLionel Sambuc }; 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc struct B { 26*f4a2713aSLionel Sambuc B(const A1& = A1(), const A2& = A2()); 27*f4a2713aSLionel Sambuc }; 28*f4a2713aSLionel Sambuc 29*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_Z2f1v() 30*f4a2713aSLionel Sambuc void f1() { 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambuc // CHECK: call void @_ZN2A1C1Ev( 33*f4a2713aSLionel Sambuc // CHECK: call void @_ZN2A2C1Ev( 34*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1BC1ERK2A1RK2A2( 35*f4a2713aSLionel Sambuc // CHECK: call void @_ZN2A2D1Ev 36*f4a2713aSLionel Sambuc // CHECK: call void @_ZN2A1D1Ev 37*f4a2713aSLionel Sambuc B bs[2]; 38*f4a2713aSLionel Sambuc } 39*f4a2713aSLionel Sambuc 40*f4a2713aSLionel Sambuc struct C { 41*f4a2713aSLionel Sambuc B bs[2]; 42*f4a2713aSLionel Sambuc C(); 43*f4a2713aSLionel Sambuc }; 44*f4a2713aSLionel Sambuc 45*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_ZN1CC1Ev(%struct.C* %this) unnamed_addr 46*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1CC2Ev( 47*f4a2713aSLionel Sambuc 48*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_ZN1CC2Ev(%struct.C* %this) unnamed_addr 49*f4a2713aSLionel Sambuc // CHECK: call void @_ZN2A1C1Ev( 50*f4a2713aSLionel Sambuc // CHECK: call void @_ZN2A2C1Ev( 51*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1BC1ERK2A1RK2A2( 52*f4a2713aSLionel Sambuc // CHECK: call void @_ZN2A2D1Ev 53*f4a2713aSLionel Sambuc // CHECK: call void @_ZN2A1D1Ev 54*f4a2713aSLionel Sambuc C::C() { } 55*f4a2713aSLionel Sambuc 56*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_Z2f3v() 57*f4a2713aSLionel Sambuc void f3() { 58*f4a2713aSLionel Sambuc // CHECK: call void @_ZN2A1C1Ev( 59*f4a2713aSLionel Sambuc // CHECK: call void @_ZN2A2C1Ev( 60*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1BC1ERK2A1RK2A2( 61*f4a2713aSLionel Sambuc // CHECK: call void @_ZN2A2D1Ev 62*f4a2713aSLionel Sambuc // CHECK: call void @_ZN2A1D1Ev 63*f4a2713aSLionel Sambuc B *bs = new B[2]; 64*f4a2713aSLionel Sambuc delete bs; 65*f4a2713aSLionel Sambuc } 66*f4a2713aSLionel Sambuc 67*f4a2713aSLionel Sambuc void f4() { 68*f4a2713aSLionel Sambuc void g4(int a, int b = 7); 69*f4a2713aSLionel Sambuc { 70*f4a2713aSLionel Sambuc void g4(int a, int b = 5); 71*f4a2713aSLionel Sambuc } 72*f4a2713aSLionel Sambuc void g4(int a = 5, int b); 73*f4a2713aSLionel Sambuc 74*f4a2713aSLionel Sambuc // CHECK: call void @_Z2g4ii(i32 5, i32 7) 75*f4a2713aSLionel Sambuc g4(); 76*f4a2713aSLionel Sambuc } 77