OSDN Git Service

PR c++/53549
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / eh / cond4.C
1 // Runtime version of cond3.C.  We call terminate when the A cleanup throws
2 // because we've already initialized the exception object.
3 // { dg-do run }
4
5 #include <exception>
6 #include <cstdlib>
7
8 void my_terminate ()
9 {
10   std::exit (0);
11 }
12
13 struct A {
14   A(int) { }
15   ~A() { throw 1; };
16 };
17 struct B {
18   B(A) { }
19   ~B() { }
20 };
21 bool b;
22
23 int main()
24 {
25   std::set_terminate (my_terminate);
26   try
27     {
28       throw b ? B(1) : B(1);
29     }
30   catch (...) { }
31   return 1;
32 }