// { dg-do run } // Origin: Giovanni Bajo // DR193: Order of destruction of local automatics of destructor extern "C" void abort(void); namespace N1 { bool a_done = false; struct A { ~A() { a_done = true; } }; struct B { ~B() { if (!a_done) abort(); } }; struct C { B x; ~C() { A y; } }; } namespace N2 { bool a_done = false; template struct A { ~A() { a_done = true; } }; template struct B { ~B() { if (!a_done) abort(); } }; template struct C { B x; ~C() { A y; } }; } int main(void) { N1::C c1; N2::C c2; return 0; }