summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.eh/inline2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.eh/inline2.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.eh/inline2.C25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/inline2.C b/gcc/testsuite/g++.old-deja/g++.eh/inline2.C
new file mode 100644
index 000000000..356c85a7c
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.eh/inline2.C
@@ -0,0 +1,25 @@
+// { dg-do run }
+// { dg-options "-O" }
+// Test that inlining a destructor with a catch block doesn't confuse the
+// enclosing try block.
+
+struct A {
+ ~A()
+ {
+ try { throw 1; }
+ catch (...) { }
+ }
+};
+
+int main ()
+{
+ try
+ {
+ A a;
+ throw 42;
+ }
+ catch (int i)
+ {
+ return (i != 42);
+ }
+}