aboutsummaryrefslogtreecommitdiff
path: root/test/initializerr.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2012-12-17 11:05:58 -0500
committerRuss Cox <rsc@golang.org>2012-12-17 11:05:58 -0500
commit94430937ac9330a4c7e8ed23659bc4475f520739 (patch)
treee201b7c2c14390b5b4595a9b977596944af5ee70 /test/initializerr.go
parentbcb495b39aebd55dd3e4502807646eec7023c5f3 (diff)
downloadgo-94430937ac9330a4c7e8ed23659bc4475f520739.tar.gz
go-94430937ac9330a4c7e8ed23659bc4475f520739.zip
test: add "duplicate" struct map key test
Update #4555. R=gri, iant CC=golang-dev https://golang.org/cl/6944059
Diffstat (limited to 'test/initializerr.go')
-rw-r--r--test/initializerr.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/initializerr.go b/test/initializerr.go
index 48908c3478..ca05414554 100644
--- a/test/initializerr.go
+++ b/test/initializerr.go
@@ -26,3 +26,15 @@ var a5 = []byte { x: 2 } // ERROR "index"
var ok1 = S { } // should be ok
var ok2 = T { S: ok1 } // should be ok
+
+// These keys can be computed at compile time but they are
+// not constants as defined by the spec, so they do not trigger
+// compile-time errors about duplicate key values.
+// See issue 4555.
+
+type Key struct {X, Y int}
+
+var _ = map[Key]string{
+ Key{1,2}: "hello",
+ Key{1,2}: "world",
+}