1 // Copyright 2019 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Test case for issue 34946: Better synchronization of
6 // parser for function declarations that start their
7 // body's opening { on a new line.
8
9 package p
10
11 // accept Allman/BSD-style declaration but complain
12 // (implicit semicolon between signature and body)
13 func _() int
14 { /* ERROR "unexpected semicolon or newline before {" */
15 { return 0 }
16 }
17
18 func _() {}
19
20 func _(); { /* ERROR "unexpected semicolon or newline before {" */ }
21
22 func _() {}
23
View as plain text