From: Richard Henderson Date: Fri, 14 Nov 2003 07:46:10 +0000 (-0800) Subject: New test. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=98f685a20d8b62fd681843984e06cacc8f649e97;p=gcc.git New test. From-SVN: r73581 --- diff --git a/gcc/testsuite/g++.dg/eh/dtor2.C b/gcc/testsuite/g++.dg/eh/dtor2.C new file mode 100644 index 00000000000..9555b3789af --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/dtor2.C @@ -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; +}