1// errorcheck
2
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.
6
7// Verify that erroneous labels are caught by the compiler.
8// This set is caught by pass 1.
9// Does not compile.
10
11package main
12
13var x int
14
15func f() {
16L1: // ERROR "label .*L1.* defined and not used"
17	for {
18	}
19L2: // ERROR "label .*L2.* defined and not used"
20	select {
21	}
22L3: // ERROR "label .*L3.* defined and not used"
23	switch {
24	}
25L4: // ERROR "label .*L4.* defined and not used"
26	if true {
27	}
28L5: // ERROR "label .*L5.* defined and not used"
29	f()
30L6: // GCCGO_ERROR "previous"
31	f()
32L6: // ERROR "label .*L6.* already defined"
33	f()
34	if x == 20 {
35		goto L6
36	}
37
38L7:
39	for {
40		break L7
41	}
42
43L8:
44	for {
45		if x == 21 {
46			continue L8
47		}
48	}
49
50L9:
51	switch {
52	case true:
53		break L9
54	defalt: // ERROR "label .*defalt.* defined and not used"
55	}
56
57L10:
58	select {
59	default:
60		break L10
61	}
62}
63