OSDN Git Service

* gcc.dg/20020201-1.c: Use cleanup-coverage_files.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.eh / terminate1.C
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
9 void my_terminate ()
10 {
11   std::exit (0);
12 }
13
14 struct A
15 {
16   A () {}
17   A (const A&) { throw 1; }
18 };
19
20 int main (void)
21 {
22   std::set_terminate (my_terminate);
23
24   A a;
25   try { throw a; }
26   catch (...) {}
27   return 1;
28 }