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