Commit 8d61334d authored by Russ Cox's avatar Russ Cox

cmd/gc: say 'non-constant array bound' instead of 'invalid array bound'

Fixes #8196.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/141510044
parent 3d2321f6
......@@ -408,6 +408,9 @@ reswitch:
v = toint(l->val);
break;
default:
if(l->type != T && isint[l->type->etype] && l->op != OLITERAL)
yyerror("non-constant array bound %N", l);
else
yyerror("invalid array bound %N", l);
goto error;
}
......
......@@ -12,4 +12,9 @@ var c [1.5]int // ERROR "truncated"
var d ["abc"]int // ERROR "invalid array bound|not numeric"
var e [nil]int // ERROR "invalid array bound|not numeric"
var f [e]int // ERROR "invalid array bound|not constant"
var g [1<<65]int // ERROR "array bound is too large|overflows"
var g [1 << 65]int // ERROR "array bound is too large|overflows"
var h [len(a)]int // ok
func ff() string
var i [len([1]string{ff()})]int // ERROR "non-constant array bound|not constant"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment