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