mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-24 08:50:26 +08:00
New test.
From-SVN: r73581
This commit is contained in:
parent
aede75ed61
commit
98f685a20d
30
gcc/testsuite/g++.dg/eh/dtor2.C
Normal file
30
gcc/testsuite/g++.dg/eh/dtor2.C
Normal file
@ -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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user