diff --git a/src/cmd/gc/go.errors b/src/cmd/gc/go.errors index e29cfff5bd4..68a5e5af3aa 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 588890d0edf..256c48b0ec8 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 00000000000..6565334935b --- /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" +}