default-destructor-synthesis.cpp revision 6b48720ae0ae977ca052472562fadb498a6dcb6f
1// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -O0 -S %s -o %t-64.s &&
2// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s &&
3// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -O0 -S %s -o %t-32.s &&
4// RUN: FileCheck -check-prefix LP32 -input-file=%t-32.s %s &&
5// RUN: true
6
7extern "C" int printf(...);
8
9int count = 1;
10
11struct S {
12  S() : iS(count++), fS(1.23) {};
13  ~S(){printf("S::~S(%d, %f)\n", iS, fS); };
14  int iS;
15  float fS;
16};
17
18struct Q {
19  Q() : iQ(count++), dQ(2.34) {};
20  ~Q(){printf("Q::~Q(%d, %f)\n", iQ, dQ); };
21  int iQ;
22  double dQ;
23};
24
25struct P {
26  P() : fP(3.45) , iP(count++) {};
27  ~P(){printf("P::~P(%d, %f)\n", iP, fP); };
28  float fP;
29  int iP;
30};
31
32struct M  : Q, P {
33  S s;
34
35  Q q;
36
37  P p;
38
39 P p_arr[3];
40
41 Q q_arr[2][3];
42
43};
44
45M gm;
46
47int main() {M m1;}
48
49// CHECK-LP64:  call	__ZN1MC1Ev
50// CHECK-LP64:  call	__ZN1MD1Ev
51// CHECK-LP64:  .globl	__ZN1MD1Ev
52// CHECK-LP64-NEXT:  .weak_definition __ZN1MD1Ev
53// CHECK-LP64-NEXT:  __ZN1MD1Ev:
54
55
56// CHECK-LP32:  call	L__ZN1MC1Ev
57// CHECK-LP32:  call	L__ZN1MD1Ev
58// CHECK-LP32:  .globl	__ZN1MD1Ev
59// CHECK-LP32-NEXT:  .weak_definition __ZN1MD1Ev
60// CHECK-LP32-NEXT:  __ZN1MD1Ev:
61