typecheck(&l->left, Erv);
evconst(l->left);
i = nonnegconst(l->left);
- if(i < 0) {
+ if(i < 0 && !l->left->diag) {
yyerror("array index must be non-negative integer constant");
+ l->left->diag = 1;
i = -(1<<30); // stay negative for a while
}
if(i >= 0)
var x int
var a = []int{ x: 1} // ERROR "constant"
-var b = [...]int{ x : 1} // ERROR "constant"
+var b = [...]int{x: 1}
var c = map[int]int{ x: 1}
--- /dev/null
+// errorcheck
+
+// Copyright 2014 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.
+
+// Issue 7153: array invalid index error duplicated on successive bad values
+
+package p
+
+var _ = []int{a: true, true} // ERROR "undefined: a" "cannot use true \(type bool\) as type int in array element"