summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/goto3.C
blob: e063ad27dc7a59be4f496edc8b110656d9b6f16e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 "" } 
}