OSDN Git Service

PR c++/28878
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / eh / dtor2.C
1 // PR c++/12751
2 // tree-ssa eh lowering bug ran a destructor twice for one object
3 // { dg-do run }
4
5 static int check;
6
7 struct Y {
8   Y();
9   ~Y();
10 };
11
12 void foo() {
13   Y y1;
14   Y y2;
15   switch(0) {
16     case 1: {
17         Y y3;
18         return;
19       }
20   }
21 }
22
23 Y::Y() { ++check; }
24 Y::~Y() { --check; }
25
26 int main()
27 {
28   foo ();
29   return check;
30 }