summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/goto4.C
blob: fa0dd5a797aee1dfd53527d1ffa911fe16cf309d (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
// { dg-do run  }
// Test that we clean up temporaries bound to references properly when
// jumping out of their scope.

int ret = 1;

struct A
{
  ~A() { ret = 0; }
};

void f()
{
  if (0)
    {
    out:
      return;
    }
  const A& a = A();
  goto out;
}

int main()
{
  f();
  return ret;
}