diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/eh/elide2.C')
-rw-r--r-- | gcc/testsuite/g++.dg/eh/elide2.C | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/eh/elide2.C b/gcc/testsuite/g++.dg/eh/elide2.C new file mode 100644 index 000000000..7d65d9ee6 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/elide2.C @@ -0,0 +1,31 @@ +// PR c++/13944 + +// Verify that we don't call terminate() if initializing the exception +// object throws. + +// { dg-do run } + +struct A +{ + A() { } + A(const A&) { throw 1; } +}; + +A a; + +int main() +{ + try + { + throw a; + } + catch (int) + { + return 0; + } + catch (A&) + { + return 2; + } + return 3; +} |