blob: 41b0118fe8a94696152f5b689b94add0a225a763 [file] [log] [blame]
Galina Kistanova0ccb31c2011-06-03 22:24:54 +00001// REQUIRES: x86-registered-target,x86-64-registered-target
Daniel Dunbara5728872009-12-15 20:14:24 +00002// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
Fariborz Jahanian72c21532009-11-13 19:27:47 +00003// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
Daniel Dunbara5728872009-12-15 20:14:24 +00004// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
Fariborz Jahanian72c21532009-11-13 19:27:47 +00005// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
6
7extern "C" int printf(...);
8
9int count;
10
11struct S {
12 S() : iS (++count) { printf("S::S(%d)\n", iS); }
13 ~S() { printf("S::~S(%d)\n", iS); }
14 int iS;
15};
16
Fariborz Jahanian534ba902009-11-13 22:29:45 +000017struct V {
18 V() : iV (++count) { printf("V::V(%d)\n", iV); }
19 virtual ~V() { printf("V::~V(%d)\n", iV); }
20 int iV;
21};
22
Fariborz Jahanian72c21532009-11-13 19:27:47 +000023struct COST
24{
25 S *cost;
Fariborz Jahanian534ba902009-11-13 22:29:45 +000026 V *vcost;
Fariborz Jahanian72c21532009-11-13 19:27:47 +000027 unsigned *cost_val;
28
29 ~COST();
30 COST();
31};
32
33
34COST::COST()
35{
36 cost = new S[3];
Fariborz Jahanian534ba902009-11-13 22:29:45 +000037 vcost = new V[4];
Fariborz Jahanian72c21532009-11-13 19:27:47 +000038 cost_val = new unsigned[10];
39}
40
41COST::~COST()
42{
43 if (cost) {
44 delete [] cost;
45 }
Fariborz Jahanian534ba902009-11-13 22:29:45 +000046 if (vcost) {
47 delete [] vcost;
48 }
Fariborz Jahanian72c21532009-11-13 19:27:47 +000049 if (cost_val)
50 delete [] cost_val;
51}
52
53COST c1;
54
55int main()
56{
57 COST c3;
58}
59COST c2;
60
Sean Callanan3b299012009-12-18 00:04:09 +000061// CHECK-LP64: callq __ZdaPv
Fariborz Jahanian72c21532009-11-13 19:27:47 +000062
Chris Lattner398e6b92010-09-22 06:09:31 +000063// CHECK-LP32: calll L__ZdaPv
Fariborz Jahanian72c21532009-11-13 19:27:47 +000064