OSDN Git Service

New test.
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 14 Nov 2003 07:46:10 +0000 (07:46 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 14 Nov 2003 07:46:10 +0000 (07:46 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73581 138bc75d-0d04-0410-961f-82ee72b054a4

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;
+}