1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -emit-llvm -o %t 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc extern "C" int printf(...); 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambuc static int val; 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc struct B { BB8*f4a2713aSLionel Sambuc B() : iB(++val) { printf("B()\n"); } 9*f4a2713aSLionel Sambuc int iB; ~BB10*f4a2713aSLionel Sambuc ~B() { printf("~B(%d)\n", iB); --val; } 11*f4a2713aSLionel Sambuc }; 12*f4a2713aSLionel Sambuc 13*f4a2713aSLionel Sambuc struct M : B { MM14*f4a2713aSLionel Sambuc M() : iM(++val) { printf("M()\n"); } 15*f4a2713aSLionel Sambuc int iM; ~MM16*f4a2713aSLionel Sambuc ~M() { printf("~M(%d)\n", iM); --val; } 17*f4a2713aSLionel Sambuc }; 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc struct P { PP20*f4a2713aSLionel Sambuc P() : iP(++val) { printf("P()\n"); } 21*f4a2713aSLionel Sambuc int iP; ~PP22*f4a2713aSLionel Sambuc ~P() { printf("~P(%d)\n", iP); --val; } 23*f4a2713aSLionel Sambuc }; 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc struct N : M, P { NN26*f4a2713aSLionel Sambuc N() { printf("N()\n"); iN = ++val; } ~NN27*f4a2713aSLionel Sambuc ~N() { printf("~N(%d) val = %d\n", iN, --val); } 28*f4a2713aSLionel Sambuc int iN; 29*f4a2713aSLionel Sambuc M m; 30*f4a2713aSLionel Sambuc P p; 31*f4a2713aSLionel Sambuc }; 32*f4a2713aSLionel Sambuc 33*f4a2713aSLionel Sambuc struct O : B { ~OO34*f4a2713aSLionel Sambuc ~O() { return; } 35*f4a2713aSLionel Sambuc }; 36*f4a2713aSLionel Sambuc main()37*f4a2713aSLionel Sambucint main() { 38*f4a2713aSLionel Sambuc N n1; 39*f4a2713aSLionel Sambuc N n2; 40*f4a2713aSLionel Sambuc O o; 41*f4a2713aSLionel Sambuc } 42