diff options
author | Russ Cox <rsc@golang.org> | 2014-04-03 19:04:33 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2014-04-03 19:04:33 -0400 |
commit | de88fd9cbda516cb96d25229cb013e73884307e6 (patch) | |
tree | 51a3568713f6aceddb1d96c3823669dc8bacedbd /test/const5.go | |
parent | f3fce6e325171c742a7c6ef61e22307e9a9c090d (diff) | |
download | go-de88fd9cbda516cb96d25229cb013e73884307e6.tar.gz |
cmd/gc: reject builtin function calls in len(fixed array) constants
Fixes issue 7385.
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://codereview.appspot.com/84010044
Diffstat (limited to 'test/const5.go')
-rw-r--r-- | test/const5.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/const5.go b/test/const5.go index 87fe33a38..60b4d0d12 100644 --- a/test/const5.go +++ b/test/const5.go @@ -18,6 +18,7 @@ var s [][30]int func f() *[40]int var c chan *[50]int +var z complex128 const ( n1 = len(b.a) @@ -29,5 +30,8 @@ const ( n6 = cap(f()) // ERROR "is not a constant|is not constant" n7 = cap(<-c) // ERROR "is not a constant|is not constant" + n8 = real(z) // ERROR "is not a constant|is not constant" + n9 = len([4]float64{real(z)}) // ERROR "is not a constant|is not constant" + ) |