1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \ 2*0a6a1f1dSLionel Sambuc // RUN: FileCheck %s 3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \ 4*0a6a1f1dSLionel Sambuc // RUN: FileCheck %s 5f4a2713aSLionel Sambuc 6f4a2713aSLionel Sambuc extern "C" int printf(...); 7f4a2713aSLionel Sambuc 8f4a2713aSLionel Sambuc int count; 9f4a2713aSLionel Sambuc 10f4a2713aSLionel Sambuc struct S { SS11f4a2713aSLionel Sambuc S() : iS (++count) { printf("S::S(%d)\n", iS); } ~SS12f4a2713aSLionel Sambuc ~S() { printf("S::~S(%d)\n", iS); } 13f4a2713aSLionel Sambuc int iS; 14f4a2713aSLionel Sambuc }; 15f4a2713aSLionel Sambuc 16f4a2713aSLionel Sambuc struct V { VV17f4a2713aSLionel Sambuc V() : iV (++count) { printf("V::V(%d)\n", iV); } ~VV18f4a2713aSLionel Sambuc virtual ~V() { printf("V::~V(%d)\n", iV); } 19f4a2713aSLionel Sambuc int iV; 20f4a2713aSLionel Sambuc }; 21f4a2713aSLionel Sambuc 22f4a2713aSLionel Sambuc struct COST 23f4a2713aSLionel Sambuc { 24f4a2713aSLionel Sambuc S *cost; 25f4a2713aSLionel Sambuc V *vcost; 26f4a2713aSLionel Sambuc unsigned *cost_val; 27f4a2713aSLionel Sambuc 28f4a2713aSLionel Sambuc ~COST(); 29f4a2713aSLionel Sambuc COST(); 30f4a2713aSLionel Sambuc }; 31f4a2713aSLionel Sambuc 32f4a2713aSLionel Sambuc COST()33f4a2713aSLionel SambucCOST::COST() 34f4a2713aSLionel Sambuc { 35f4a2713aSLionel Sambuc cost = new S[3]; 36f4a2713aSLionel Sambuc vcost = new V[4]; 37f4a2713aSLionel Sambuc cost_val = new unsigned[10]; 38f4a2713aSLionel Sambuc } 39f4a2713aSLionel Sambuc ~COST()40f4a2713aSLionel SambucCOST::~COST() 41f4a2713aSLionel Sambuc { 42f4a2713aSLionel Sambuc if (cost) { 43f4a2713aSLionel Sambuc delete [] cost; 44f4a2713aSLionel Sambuc } 45f4a2713aSLionel Sambuc if (vcost) { 46f4a2713aSLionel Sambuc delete [] vcost; 47f4a2713aSLionel Sambuc } 48f4a2713aSLionel Sambuc if (cost_val) 49f4a2713aSLionel Sambuc delete [] cost_val; 50f4a2713aSLionel Sambuc } 51f4a2713aSLionel Sambuc 52f4a2713aSLionel Sambuc COST c1; 53f4a2713aSLionel Sambuc main()54f4a2713aSLionel Sambucint main() 55f4a2713aSLionel Sambuc { 56f4a2713aSLionel Sambuc COST c3; 57f4a2713aSLionel Sambuc } 58f4a2713aSLionel Sambuc COST c2; 59f4a2713aSLionel Sambuc 60*0a6a1f1dSLionel Sambuc // CHECK: call void @_ZdaPv 61f4a2713aSLionel Sambuc 62