2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.eh / terminate1.C
blob09dd84f0ca217cac1a9226057123d9fd92618bc7
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.
6 #include <exception>
7 #include <cstdlib>
9 void my_terminate ()
11   std::exit (0);
14 struct A
16   A () {}
17   A (const A&) { throw 1; }
20 int main (void)
22   std::set_terminate (my_terminate);
24   A a;
25   try { throw a; }
26   catch (...) {}
27   return 1;