testsuite: XFAIL gfortran.dg/initialization_25.f90 properly (again)
[official-gcc.git] / gcc / testsuite / go.test / test / label1.go
bloba8eaecbff2fa0a50f0af0dabe807aafee7022825
1 // errorcheck
3 // Copyright 2011 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Verify that erroneous labels are caught by the compiler.
8 // This set is caught by pass 2. That's why this file is label1.go.
9 // Does not compile.
11 package main
13 var x int
15 func f1() {
16 switch x {
17 case 1:
18 continue // ERROR "continue is not in a loop$|continue statement not within for"
20 select {
21 default:
22 continue // ERROR "continue is not in a loop$|continue statement not within for"
27 func f2() {
28 L1:
29 for {
30 if x == 0 {
31 break L1
33 if x == 1 {
34 continue L1
36 goto L1
39 L2:
40 select {
41 default:
42 if x == 0 {
43 break L2
45 if x == 1 {
46 continue L2 // ERROR "invalid continue label .*L2|continue is not in a loop$"
48 goto L2
51 for {
52 if x == 1 {
53 continue L2 // ERROR "invalid continue label .*L2"
57 L3:
58 switch {
59 case x > 10:
60 if x == 11 {
61 break L3
63 if x == 12 {
64 continue L3 // ERROR "invalid continue label .*L3|continue is not in a loop$"
66 goto L3
69 L4:
70 if true {
71 if x == 13 {
72 break L4 // ERROR "invalid break label .*L4"
74 if x == 14 {
75 continue L4 // ERROR "invalid continue label .*L4|continue is not in a loop$"
77 if x == 15 {
78 goto L4
82 L5:
83 f2()
84 if x == 16 {
85 break L5 // ERROR "invalid break label .*L5"
87 if x == 17 {
88 continue L5 // ERROR "invalid continue label .*L5|continue is not in a loop$"
90 if x == 18 {
91 goto L5
94 for {
95 if x == 19 {
96 break L1 // ERROR "invalid break label .*L1"
98 if x == 20 {
99 continue L1 // ERROR "invalid continue label .*L1"
101 if x == 21 {
102 goto L1
106 continue // ERROR "continue is not in a loop$|continue statement not within for"
107 for {
108 continue on // ERROR "continue label not defined: on|invalid continue label .*on"
111 break // ERROR "break is not in a loop, switch, or select|break statement not within for or switch or select"
112 for {
113 break dance // ERROR "break label not defined: dance|invalid break label .*dance"
116 for {
117 switch x {
118 case 1:
119 continue