[PR c++/84702] ICE with default tmpl arg of overload set
[official-gcc.git] / gcc / testsuite / g++.dg / eh / cond4.C
blob68fb65c7c2a840b57630d226607a5336b9cedc57
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 }
5 #include <exception>
6 #include <cstdlib>
8 void my_terminate ()
10   std::exit (0);
13 struct A {
14   A(int) { }
15   ~A()
16 #if __cplusplus <= 201402L
17   throw(int)                    // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
18 #else
19   noexcept(false)
20 #endif
21   { throw 1; };
23 struct B {
24   B(A) { }
25   ~B() { }
27 bool b;
29 int main()
31   std::set_terminate (my_terminate);
32   try
33     {
34       throw b ? B(1) : B(1);
35     }
36   catch (...) { }
37   return 1;