new
authorJason Merrill <jason@gcc.gnu.org>
Thu, 19 Aug 1999 18:45:07 +0000 (14:45 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 19 Aug 1999 18:45:07 +0000 (14:45 -0400)
From-SVN: r28764

gcc/testsuite/g++.old-deja/g++.eh/fntry1.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.old-deja/g++.eh/fntry1.C b/gcc/testsuite/g++.old-deja/g++.eh/fntry1.C
new file mode 100644 (file)
index 0000000..9c1c0ff
--- /dev/null
@@ -0,0 +1,31 @@
+// Bug: g++ fails to treat function-try-blocks in ctors specially.
+// Submitted by Jason Merrill <jason@cygnus.com>
+
+int c;
+int r;
+
+struct A {
+  int i;
+  A(int j) { i = j; }
+  ~A() { c += i; }
+};
+
+struct B: public A {
+  A a;
+  B() try : A(1), a(2)
+    { throw 1; }
+  catch (...)
+    { if (c != 3) r |= 1; }
+};
+
+int main ()
+{
+  try
+    { B b; }
+  catch (...)
+    { c = 0; }
+
+  if (c != 0) r |= 2;
+
+  return r;
+}