array-operator-delete-call.cpp revision 72c2153b466263a21870b2b1c817900d4981493e
1// 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 16struct COST 17{ 18 S *cost; 19 unsigned *cost_val; 20 21 ~COST(); 22 COST(); 23}; 24 25 26COST::COST() 27{ 28 cost = new S[3]; 29 cost_val = new unsigned[10]; 30} 31 32COST::~COST() 33{ 34 if (cost) { 35 delete [] cost; 36 } 37 if (cost_val) 38 delete [] cost_val; 39} 40 41COST c1; 42 43int main() 44{ 45 COST c3; 46} 47COST c2; 48 49// CHECK-LP64: call __ZdaPv 50 51// CHECK-LP32: call L__ZdaPv 52 53