default-destructor-synthesis.cpp revision a5728872c7702ddd09537c95bc3cbd20e1f2fb09
1// RUN: %clang_cc1 -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_cc1 -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
6extern "C" int printf(...);
7
8int count = 1;
9
10struct S {
11  S() : iS(count++), fS(1.23) {};
12  ~S(){printf("S::~S(%d, %f)\n", iS, fS); };
13  int iS;
14  float fS;
15};
16
17struct Q {
18  Q() : iQ(count++), dQ(2.34) {};
19  ~Q(){printf("Q::~Q(%d, %f)\n", iQ, dQ); };
20  int iQ;
21  double dQ;
22};
23
24struct P {
25  P() : fP(3.45) , iP(count++) {};
26  ~P(){printf("P::~P(%d, %f)\n", iP, fP); };
27  float fP;
28  int iP;
29};
30
31struct M  : Q, P {
32  S s;
33
34  Q q;
35
36  P p;
37
38 P p_arr[3];
39
40 Q q_arr[2][3];
41
42};
43
44M gm;
45
46int main() {M m1;}
47
48// CHECK-LP64: call __ZN1MC1Ev
49// CHECK-LP64: call __ZN1MD1Ev
50// CHECK-LP64: .globl __ZN1MD1Ev
51// CHECK-LP64-NEXT: .weak_definition __ZN1MD1Ev
52// CHECK-LP64-NEXT: __ZN1MD1Ev:
53
54
55// CHECK-LP32: call L__ZN1MC1Ev
56// CHECK-LP32: call L__ZN1MD1Ev
57// CHECK-LP32: .globl __ZN1MD1Ev
58// CHECK-LP32-NEXT: .weak_definition __ZN1MD1Ev
59// CHECK-LP32-NEXT:__ZN1MD1Ev:
60