blob: 4d8d1f7c4018abe34e6d435c36f741bf5bce843a [file] [log] [blame]
Douglas Gregor0d405db2010-07-01 20:59:04 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s
2
Douglas Gregoreb8c6702010-07-01 22:31:05 +00003// Copy constructor
Douglas Gregor0d405db2010-07-01 20:59:04 +00004struct X0 {
5 X0();
6 X0(const X0 &) throw();
7 X0(X0 &);
8};
9
10struct X1 {
11 X1();
12 X1(const X1 &) throw();
13};
14
15struct X2 : X1 {
16 X2();
17};
18struct X3 : X0, X1 {
19 X3();
20};
21
22struct X4 {
23 X4(X4 &) throw();
24};
25
26struct X5 : X0, X4 { };
27
28void test(X2 x2, X3 x3, X5 x5) {
29 // CHECK: define linkonce_odr void @_ZN2X2C1ERKS_
John McCall9c0c1f32010-07-08 06:48:12 +000030 // CHECK: call void @_ZN2X2C2ERKS_({{.*}}) nounwind
31 // CHECK-NEXT: ret void
32 // CHECK-NEXT: }
Douglas Gregor0d405db2010-07-01 20:59:04 +000033 X2 x2a(x2);
34 // CHECK: define linkonce_odr void @_ZN2X3C1ERKS_
John McCall9c0c1f32010-07-08 06:48:12 +000035 // CHECK: call void @_ZN2X3C2ERKS_({{.*}}) nounwind
36 // CHECK-NEXT: ret void
37 // CHECK-NEXT: }
Douglas Gregor0d405db2010-07-01 20:59:04 +000038 X3 x3a(x3);
39 // CHECK: define linkonce_odr void @_ZN2X5C1ERS_
40 // CHECK-NOT: call void @__cxa_call_unexpected
41 // CHECK: ret void
42 X5 x5a(x5);
43}
Douglas Gregoreb8c6702010-07-01 22:31:05 +000044
45// Default constructor
46struct X6 {
47 X6() throw();
48};
49
50struct X7 {
51 X7();
52};
53
54struct X8 : X6 { };
55struct X9 : X6, X7 { };
56
57void test() {
58 // CHECK: define linkonce_odr void @_ZN2X8C1Ev
John McCall9c0c1f32010-07-08 06:48:12 +000059 // CHECK: call void @_ZN2X8C2Ev({{.*}}) nounwind
60 // CHECK-NEXT: ret void
Douglas Gregoreb8c6702010-07-01 22:31:05 +000061 X8();
John McCall39dbad92010-07-08 13:17:29 +000062
Douglas Gregoreb8c6702010-07-01 22:31:05 +000063 // CHECK: define linkonce_odr void @_ZN2X9C1Ev
John McCall39dbad92010-07-08 13:17:29 +000064 // FIXME: check that this is the end of the line here:
65 // CHECK: call void @_ZN2X9C2Ev({{.*}})
John McCall9c0c1f32010-07-08 06:48:12 +000066 // CHECK-NEXT: ret void
Douglas Gregoreb8c6702010-07-01 22:31:05 +000067 X9();
John McCall9c0c1f32010-07-08 06:48:12 +000068
69 // CHECK: define linkonce_odr void @_ZN2X9C2Ev
70 // CHECK: call void @_ZN2X6C2Ev({{.*}}) nounwind
John McCall39dbad92010-07-08 13:17:29 +000071 // FIXME: and here:
72 // CHECK-NEXT: call void @_ZN2X7C2Ev({{.*}})
John McCall9c0c1f32010-07-08 06:48:12 +000073 // CHECK: ret void
74
75 // CHECK: define linkonce_odr void @_ZN2X8C2Ev
76 // CHECK: call void @_ZN2X6C2Ev({{.*}}) nounwind
77 // CHECK-NEXT: ret void
Douglas Gregoreb8c6702010-07-01 22:31:05 +000078}