diff --git a/src/cmd/compile/internal/syntax/parser.go b/src/cmd/compile/internal/syntax/parser.go index a11be9717c7..79d6c8c14dd 100644 --- a/src/cmd/compile/internal/syntax/parser.go +++ b/src/cmd/compile/internal/syntax/parser.go @@ -799,7 +799,7 @@ loop: p.syntax_error("expecting name or (") p.advance(_Semi, _Rparen) } - if gcCompat { + if gcCompat && x != nil { x.init(p) } diff --git a/test/fixedbugs/issue19056.go b/test/fixedbugs/issue19056.go new file mode 100644 index 00000000000..e4e8d07905a --- /dev/null +++ b/test/fixedbugs/issue19056.go @@ -0,0 +1,9 @@ +// errorcheck + +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package p + +var _ = ... . // ERROR "unexpected ..."