Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.eh/terminate1.C

raw
1 // { dg-do run }
2 // Test that an exception thrown out of the constructor for the catch
3 // parameter (i.e. "after completing evaluation of the expression to be thrown
4 // but before the exception is caught") causes us to call terminate.
5
6 #include <exception>
7 #include <cstdlib>
8
9 void my_terminate ()
10 {
11 std::exit (0);
12 }
13
14 struct A
15 {
16 A () {}
17 A (const A&) { throw 1; }
18 };
19
20 int main (void)
21 {
22 std::set_terminate (my_terminate);
23
24 try { throw A(); }
25 catch (A) {}
26 return 1;
27 }