blob: 206d4d6c88600484fff7f869f363fbbc257e35a2 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
Anders Carlsson370e5382009-11-14 01:51:50 +00002
3// PR5484
4namespace PR5484 {
5struct A { };
6extern A a;
7
8void f(const A & = a);
9
10void g() {
11 f();
12}
13}
Anders Carlsson5d4d9462009-11-24 18:43:52 +000014
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: 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
Rafael Espindola0691a5c2011-01-25 19:10:24 +000045// CHECK: define void @_ZN1CC1Ev(%struct.C* %this) unnamed_addr
John McCallc0bf4622010-02-23 00:48:20 +000046// CHECK: call void @_ZN1CC2Ev(
John McCall8e51a1f2010-02-18 21:31:48 +000047
Rafael Espindola0691a5c2011-01-25 19:10:24 +000048// CHECK: define void @_ZN1CC2Ev(%struct.C* %this) unnamed_addr
Anders Carlsson5d4d9462009-11-24 18:43:52 +000049// CHECK: call void @_ZN2A1C1Ev(
50// CHECK: call void @_ZN2A2C1Ev(
51// CHECK: call void @_ZN1BC1ERK2A1RK2A2(
52// CHECK: call void @_ZN2A2D1Ev
53// CHECK: call void @_ZN2A1D1Ev
54C::C() { }
55
56// CHECK: 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}
James Molloy9cda03f2012-03-13 08:55:35 +000066
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}