// check cleanup of template temporaries extern "C" void abort (); extern "C" void exit (int); int ctor = 0; int dtor = 0; template struct A { A() {ctor++;} A(int) {ctor++;} A(const A&) {ctor++;} ~A() {dtor++;} operator int() {return 0;} }; template void ff(T); template void ff(T) { } void g(int) { } void f() { int x; A a1; A a2(37); A a3 = A(47); A a4 = 97; g(A()); A(); x ? A() : A(); x = 47, A(), A(39), A(23), -17; while (A()) ; for (;A(3);) ; if (A >()) ; ff(A()); throw 59; } int main() { int flag = 0; try { A(); f(); } catch (int) { A(34); flag = 1; } if (!flag) abort(); if (!ctor || ctor != dtor) abort(); exit(0); }