blob: 17e9149b97555a228bfc22f17c48f4f64160109f (
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
33
34
35
36
37
38
|
// 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()
#if __cplusplus <= 201402L
throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } }
#else
noexcept(false)
#endif
{ 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;
}
|