mirror of
https://github.com/golang/go
synced 2024-11-25 10:38:00 -07:00
test: add "duplicate" struct map key test
Update #4555. R=gri, iant CC=golang-dev https://golang.org/cl/6944059
This commit is contained in:
parent
bcb495b39a
commit
94430937ac
@ -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",
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user