diff options
author | Russ Cox <rsc@golang.org> | 2013-02-01 23:10:02 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2013-02-01 23:10:02 -0500 |
commit | 8931306389c5b9a19b9b90cc7e263782edcaf579 (patch) | |
tree | fa0faf5f280aded75015df076f0ce70823d311a0 /test/const5.go | |
parent | f607c479eabab497b3e7d3dead472a19bd27e063 (diff) | |
download | go-8931306389c5b9a19b9b90cc7e263782edcaf579.tar.gz go-8931306389c5b9a19b9b90cc7e263782edcaf579.zip |
cmd/gc: reject non-Go constants
Expressions involving nil, even if they can be evaluated
at compile time, do not count as Go constants and cannot
be used in const initializers.
Fixes #4673.
Fixes #4680.
R=ken2
CC=golang-dev
https://golang.org/cl/7278043
Diffstat (limited to 'test/const5.go')
-rw-r--r-- | test/const5.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/const5.go b/test/const5.go index d0eed137d1..87fe33a385 100644 --- a/test/const5.go +++ b/test/const5.go @@ -24,10 +24,10 @@ const ( n2 = len(m[""]) n3 = len(s[10]) - n4 = len(f()) // ERROR "must be constant|is not constant" - n5 = len(<-c) // ERROR "must be constant|is not constant" + n4 = len(f()) // ERROR "is not a constant|is not constant" + n5 = len(<-c) // ERROR "is not a constant|is not constant" - n6 = cap(f()) // ERROR "must be constant|is not constant" - n7 = cap(<-c) // ERROR "must be constant|is not constant" + n6 = cap(f()) // ERROR "is not a constant|is not constant" + n7 = cap(<-c) // ERROR "is not a constant|is not constant" ) |