summaryrefslogtreecommitdiff
path: root/test/const5.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-04-03 19:04:33 -0400
committerRuss Cox <rsc@golang.org>2014-04-03 19:04:33 -0400
commitf3ecb298ad3187a6c47f43916480d396ec8c35c3 (patch)
treec6d442f9de68f1e3ce1c9860f9035001b37b70f7 /test/const5.go
parenta26c01ad446d2853f0c6a7ddaacadb02efa00b7b (diff)
downloadgo-git-f3ecb298ad3187a6c47f43916480d396ec8c35c3.tar.gz
cmd/gc: reject builtin function calls in len(fixed array) constants
Fixes #7385. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/84010044
Diffstat (limited to 'test/const5.go')
-rw-r--r--test/const5.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/const5.go b/test/const5.go
index 87fe33a385..60b4d0d12c 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"
+
)