From f1e298b92fb8286ed1b9aa24f3cdfa5dd9e0841b Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 16 Sep 2014 10:21:54 -0400 Subject: cmd/gc: say 'non-constant array bound' instead of 'invalid array bound' Fixes issue 8196. LGTM=adonovan R=adonovan CC=golang-codereviews https://codereview.appspot.com/141510044 --- test/fixedbugs/bug255.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/fixedbugs/bug255.go b/test/fixedbugs/bug255.go index acf4f2391..65ed1b8f6 100644 --- a/test/fixedbugs/bug255.go +++ b/test/fixedbugs/bug255.go @@ -6,10 +6,15 @@ package main -var a [10]int // ok -var b [1e1]int // ok -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 a [10]int // ok +var b [1e1]int // ok +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 h [len(a)]int // ok + +func ff() string + +var i [len([1]string{ff()})]int // ERROR "non-constant array bound|not constant" -- cgit v1.2.1