aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/eh/cond4.C
blob: a8d1cfbf3e2acb8a3c2c0fbc9695b93134bc5540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Runtime version of cond3.C.  We call terminate when the A cleanup throws
// because we've already initialized the exception object.
// { dg-do run }

#include <exception>
#include <cstdlib>

void my_terminate ()
{
  std::exit (0);
}

struct A {
  A(int) { }
  ~A() { throw 1; };
};
struct B {
  B(A) { }
  ~B() { }
};
bool b;

int main()
{
  std::set_terminate (my_terminate);
  try
    {
      throw b ? B(1) : B(1);
    }
  catch (...) { }
  return 1;
}