diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/goto3.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/goto3.C | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/goto3.C b/gcc/testsuite/g++.old-deja/g++.other/goto3.C new file mode 100644 index 000000000..e063ad27d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/goto3.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// Testcase for various invalid gotos. +// Origin: Jason Merrill <jason@redhat.com> + +void f () +{ + goto foo1; // { dg-error "" } jumps + try { foo1:; } catch (...) { } // { dg-error "" } into try + goto foo2; // { dg-error "" } jumps + try { } catch (...) { foo2:; } // { dg-error "" } into catch + goto foo3; // { dg-error "" } jumps + { int i=2; foo3:; } // { dg-error "" } past init + + try { foo4:; } catch (...) { } // { dg-error "" } + goto foo4; // { dg-error "" } + try { } catch (...) { foo5:; } // { dg-error "" } + goto foo5; // { dg-error "" } + { int i=2; foo6:; } // { dg-error "" } + goto foo6; // { dg-error "" } +} |