summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/eh/goto1.C
blob: f3e3e4216fb678e8421f76e63e1cf47ced921dd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
extern "C" void abort ();

static int count;

struct S {
  S() { ++count; }
  ~S() { --count; }
};

int foo(int p)
{
  S s1;
  {
    S s2;
    if (p)
      goto L;
    else
      return 1;
  }
  foo (p);
 L:
  return 0;
}

int main()
{
  foo(0);
  if (count != 0)
    abort ();
  foo(1);
  if (count != 0)
    abort ();
  return 0;
}