diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/goto4.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/goto4.C | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/goto4.C b/gcc/testsuite/g++.old-deja/g++.other/goto4.C new file mode 100644 index 000000000..fa0dd5a79 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/goto4.C @@ -0,0 +1,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; +} |