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