1 // { dg-do run } 2 // Test that an exception thrown out of the constructor for the exception 3 // object (i.e. "after completing evaluation of the expression to be thrown 4 // but before the exception is caught") causes us to call terminate. 5 6 #include <exception> 7 #include <cstdlib> 8 my_terminate()9void my_terminate () 10 { 11 std::exit (0); 12 } 13 14 struct A 15 { AA16 A () {} AA17 A (const A&) { throw 1; } 18 }; 19 main(void)20int main (void) 21 { 22 std::set_terminate (my_terminate); 23 24 A a; 25 try { throw a; } 26 catch (...) {} 27 return 1; 28 } 29