1 // Copyright (C) 1999 Free Software Foundation 2 3 // by Alexandre Oliva <oliva@lsd.ic.unicamp.br> 4 5 // Test whether dtors of vbases are called on throw within new[]. 6 // Variant of delete2.C. 7 8 extern "C" void abort(); 9 extern "C" void exit(int); 10 11 struct Foo { 12 static bool first; 13 FooFoo14 Foo() { 15 if (first) 16 first = false; 17 else 18 throw first; 19 } 20 ~FooFoo21 ~Foo() { 22 exit(0); 23 } 24 }; 25 26 bool Foo::first = true; 27 28 struct Bar : virtual Foo { 29 }; 30 main()31int main() { 32 try { 33 delete [] new Bar[2]; 34 } catch (...) { 35 } 36 abort(); 37 } 38