Skip to content

cmd/gc: No duplicate key error for maps with interface{} key type #7214

Closed
@gopherbot

Description

@gopherbot

by carlchatfielduntrusted:

_ = map[interface{}]int{2: 1, 2: 1}
spec: For map literals, all elements must have a key. It is an error to specify multiple
elements with the same field name or constant key value. 

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
http://play.golang.org/p/sfi-13X_u5

What is the expected output?
duplicate key in map literal

What do you see instead?
none

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g/8g

Which operating system are you using?
linux

Which version are you using?  (run 'go version')
1.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions