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 
my_terminate()8 void my_terminate ()
9 {
10   std::exit (0);
11 }
12 
13 struct A {
AA14   A(int) { }
15   ~A()
16 #if __cplusplus <= 201402L
throwA17   throw(int)			// { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
18 #else
19   noexcept(false)
20 #endif
21   { throw 1; };
22 };
23 struct B {
BB24   B(A) { }
~BB25   ~B() { }
26 };
27 bool b;
28 
main()29 int main()
30 {
31   std::set_terminate (my_terminate);
32   try
33     {
34       throw b ? B(1) : B(1);
35     }
36   catch (...) { }
37   return 1;
38 }
39