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