blob: e57d147a608beac8d4a242cb6689290da5b2ddd3 [file] [log] [blame]
Colin Cross7bb052a2015-02-03 12:59:37 -08001// errorcheck
2
3// Copyright 2010 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// 6g accepts the program below even though it is syntactically incorrect:
8// Each statement in the list of statements for each case clause must be
9// terminated with a semicolon. No semicolon is present for the labeled
10// statements and because the last token is a colon ":", no semicolon is
11// inserted automatically.
12//
13// Both gccgo and gofmt correctly refuse this program as is and accept it
14// when the semicolons are present.
15
Dan Willemsen6ff23252015-09-15 13:49:18 -070016// This is a test case for issue 777 ( https://golang.org/issue/777 ).
Colin Cross7bb052a2015-02-03 12:59:37 -080017
18package main
19
20func main() {
21 switch 0 {
22 case 0:
23 L0: // ERROR "statement"
24 case 1:
25 L1: // ERROR "statement"
26 default:
27 // correct since no semicolon is required before a '}'
28 goto L2
29 L2:
30 }
31}