Debian Codegraph @

gcc/testsuite/g++.dg/eh/elide2.C

raw
1 // PR c++/13944
2
3 // Verify that we don't call terminate() if initializing the exception
4 // object throws.
5
6 // { dg-do run }
7
8 struct A
9 {
10 A() { }
11 A(const A&) { throw 1; }
12 };
13
14 A a;
15
16 int main()
17 {
18 try
19 {
20 throw a;
21 }
22 catch (int)
23 {
24 return 0;
25 }
26 catch (A&)
27 {
28 return 2;
29 }
30 return 3;
31 }