1 // REQUIRES: x86-registered-target,x86-64-registered-target 2 // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s 3 // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s 4 // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s 5 // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s 6 7 extern "C" int printf(...); 8 9 int count; 10 11 struct S { 12 S() : iS (++count) { printf("S::S(%d)\n", iS); } 13 ~S() { printf("S::~S(%d)\n", iS); } 14 int iS; 15 }; 16 17 struct 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 23 struct COST 24 { 25 S *cost; 26 V *vcost; 27 unsigned *cost_val; 28 29 ~COST(); 30 COST(); 31 }; 32 33 34 COST::COST() 35 { 36 cost = new S[3]; 37 vcost = new V[4]; 38 cost_val = new unsigned[10]; 39 } 40 41 COST::~COST() 42 { 43 if (cost) { 44 delete [] cost; 45 } 46 if (vcost) { 47 delete [] vcost; 48 } 49 if (cost_val) 50 delete [] cost_val; 51 } 52 53 COST c1; 54 55 int main() 56 { 57 COST c3; 58 } 59 COST c2; 60 61 // CHECK-LP64: callq __ZdaPv 62 63 // CHECK-LP32: calll L__ZdaPv 64 65