Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s |
Anders Carlsson | 370e538 | 2009-11-14 01:51:50 +0000 | [diff] [blame] | 2 | |
| 3 | // PR5484 |
| 4 | namespace PR5484 { |
| 5 | struct A { }; |
| 6 | extern A a; |
| 7 | |
| 8 | void f(const A & = a); |
| 9 | |
| 10 | void g() { |
| 11 | f(); |
| 12 | } |
| 13 | } |
Anders Carlsson | 5d4d946 | 2009-11-24 18:43:52 +0000 | [diff] [blame] | 14 | |
| 15 | struct A1 { |
| 16 | A1(); |
| 17 | ~A1(); |
| 18 | }; |
| 19 | |
| 20 | struct A2 { |
| 21 | A2(); |
| 22 | ~A2(); |
| 23 | }; |
| 24 | |
| 25 | struct B { |
| 26 | B(const A1& = A1(), const A2& = A2()); |
| 27 | }; |
| 28 | |
| 29 | // CHECK: define void @_Z2f1v() |
| 30 | void 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 | |
| 40 | struct C { |
| 41 | B bs[2]; |
| 42 | C(); |
| 43 | }; |
| 44 | |
Rafael Espindola | 0691a5c | 2011-01-25 19:10:24 +0000 | [diff] [blame] | 45 | // CHECK: define void @_ZN1CC1Ev(%struct.C* %this) unnamed_addr |
John McCall | c0bf462 | 2010-02-23 00:48:20 +0000 | [diff] [blame] | 46 | // CHECK: call void @_ZN1CC2Ev( |
John McCall | 8e51a1f | 2010-02-18 21:31:48 +0000 | [diff] [blame] | 47 | |
Rafael Espindola | 0691a5c | 2011-01-25 19:10:24 +0000 | [diff] [blame] | 48 | // CHECK: define void @_ZN1CC2Ev(%struct.C* %this) unnamed_addr |
Anders Carlsson | 5d4d946 | 2009-11-24 18:43:52 +0000 | [diff] [blame] | 49 | // CHECK: call void @_ZN2A1C1Ev( |
| 50 | // CHECK: call void @_ZN2A2C1Ev( |
| 51 | // CHECK: call void @_ZN1BC1ERK2A1RK2A2( |
| 52 | // CHECK: call void @_ZN2A2D1Ev |
| 53 | // CHECK: call void @_ZN2A1D1Ev |
| 54 | C::C() { } |
| 55 | |
| 56 | // CHECK: define void @_Z2f3v() |
| 57 | void 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 Molloy | 9cda03f | 2012-03-13 08:55:35 +0000 | [diff] [blame] | 66 | |
| 67 | void 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 | } |