blob: c23d33632a38b14ad371668a38f2c9c1711928be [file] [log] [blame]
Fariborz Jahanian72c21532009-11-13 19:27:47 +00001// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -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 -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;
9
10struct S {
11 S() : iS (++count) { printf("S::S(%d)\n", iS); }
12 ~S() { printf("S::~S(%d)\n", iS); }
13 int iS;
14};
15
Fariborz Jahanian534ba902009-11-13 22:29:45 +000016struct V {
17 V() : iV (++count) { printf("V::V(%d)\n", iV); }
18 virtual ~V() { printf("V::~V(%d)\n", iV); }
19 int iV;
20};
21
Fariborz Jahanian72c21532009-11-13 19:27:47 +000022struct COST
23{
24 S *cost;
Fariborz Jahanian534ba902009-11-13 22:29:45 +000025 V *vcost;
Fariborz Jahanian72c21532009-11-13 19:27:47 +000026 unsigned *cost_val;
27
28 ~COST();
29 COST();
30};
31
32
33COST::COST()
34{
35 cost = new S[3];
Fariborz Jahanian534ba902009-11-13 22:29:45 +000036 vcost = new V[4];
Fariborz Jahanian72c21532009-11-13 19:27:47 +000037 cost_val = new unsigned[10];
38}
39
40COST::~COST()
41{
42 if (cost) {
43 delete [] cost;
44 }
Fariborz Jahanian534ba902009-11-13 22:29:45 +000045 if (vcost) {
46 delete [] vcost;
47 }
Fariborz Jahanian72c21532009-11-13 19:27:47 +000048 if (cost_val)
49 delete [] cost_val;
50}
51
52COST c1;
53
54int main()
55{
56 COST c3;
57}
58COST c2;
59
60// CHECK-LP64: call __ZdaPv
61
62// CHECK-LP32: call L__ZdaPv
63