Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.other/goto4.C

raw
1 // { dg-do run }
2 // Test that we clean up temporaries bound to references properly when
3 // jumping out of their scope.
4
5 int ret = 1;
6
7 struct A
8 {
9 ~A() { ret = 0; }
10 };
11
12 void f()
13 {
14 if (0)
15 {
16 out:
17 return;
18 }
19 const A& a = A();
20 goto out;
21 }
22
23 int main()
24 {
25 f();
26 return ret;
27 }