diff --git a/src/cmd/gc/go.errors b/src/cmd/gc/go.errors index e29cfff5bd..68a5e5af3a 100644 --- a/src/cmd/gc/go.errors +++ b/src/cmd/gc/go.errors @@ -65,6 +65,9 @@ static struct { % loadsys package imports LVAR LNAME '=' LNAME '{' LNAME ';' "need trailing comma before newline in composite literal", + % loadsys package imports LVAR LNAME '=' comptype '{' LNAME ';' + "need trailing comma before newline in composite literal", + % loadsys package imports LFUNC LNAME '(' ')' '{' LFUNC LNAME "nested func not allowed", diff --git a/src/cmd/gc/yerr.h b/src/cmd/gc/yerr.h index 588890d0ed..256c48b0ec 100644 --- a/src/cmd/gc/yerr.h +++ b/src/cmd/gc/yerr.h @@ -65,6 +65,9 @@ static struct { 425, ';', "need trailing comma before newline in composite literal", + 435, ';', + "need trailing comma before newline in composite literal", + 112, LNAME, "nested func not allowed", diff --git a/test/syntax/composite.go b/test/syntax/composite.go new file mode 100644 index 0000000000..6565334935 --- /dev/null +++ b/test/syntax/composite.go @@ -0,0 +1,11 @@ +// errorcheck + +// Copyright 2012 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 main + +var a = []int{ + 3 // ERROR "need trailing comma before newline in composite literal" +}