New test.
authorRichard Henderson <rth@gcc.gnu.org>
Fri, 14 Nov 2003 07:46:10 +0000 (23:46 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 14 Nov 2003 07:46:10 +0000 (23:46 -0800)
From-SVN: r73581

gcc/testsuite/g++.dg/eh/dtor2.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/eh/dtor2.C b/gcc/testsuite/g++.dg/eh/dtor2.C
new file mode 100644 (file)
index 0000000..9555b37
--- /dev/null
@@ -0,0 +1,30 @@
+// PR c++/12751
+// tree-ssa eh lowering bug ran a destructor twice for one object
+// { dg-do run }
+
+static int check;
+
+struct Y {
+  Y();
+  ~Y();
+};
+
+void foo() {
+  Y y1;
+  Y y2;
+  switch(0) {
+    case 1: {
+        Y y3;
+        return;
+      }
+  }
+}
+
+Y::Y() { ++check; }
+Y::~Y() { --check; }
+
+int main()
+{
+  foo ();
+  return check;
+}