summaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/default-destructor-synthesis.cpp
blob: 32d21f0b5beaf6c39d7513ff2dc0e9243f23e42a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -O0 -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -O0 -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 -input-file=%t-32.s %s
// RUN: true

extern "C" int printf(...);

int count = 1;

struct S {
  S() : iS(count++), fS(1.23) {};
  ~S(){printf("S::~S(%d, %f)\n", iS, fS); };
  int iS;
  float fS;
};

struct Q {
  Q() : iQ(count++), dQ(2.34) {};
  ~Q(){printf("Q::~Q(%d, %f)\n", iQ, dQ); };
  int iQ;
  double dQ;
};

struct P {
  P() : fP(3.45) , iP(count++) {};
  ~P(){printf("P::~P(%d, %f)\n", iP, fP); };
  float fP;
  int iP;
};

struct M  : Q, P {
  S s;

  Q q;

  P p; 

 P p_arr[3];

 Q q_arr[2][3];

};

M gm;

int main() {M m1;}

// CHECK-LP64: call __ZN1MC1Ev
// CHECK-LP64: call __ZN1MD1Ev
// CHECK-LP64: .globl __ZN1MD1Ev
// CHECK-LP64-NEXT: .weak_definition __ZN1MD1Ev
// CHECK-LP64-NEXT: __ZN1MD1Ev:


// CHECK-LP32: call L__ZN1MC1Ev
// CHECK-LP32: call L__ZN1MD1Ev
// CHECK-LP32: .globl __ZN1MD1Ev
// CHECK-LP32-NEXT: .weak_definition __ZN1MD1Ev
// CHECK-LP32-NEXT:__ZN1MD1Ev: