New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gccgo: erroneously accepts duplicate constant keys in map literal #28104

mdempsky opened this Issue Oct 9, 2018 · 0 comments


None yet
1 participant

mdempsky commented Oct 9, 2018

Under Composite literals, the Go spec says "It is an error to specify multiple elements with the same field name or constant key value."

However, gccgo erroneously accepts this code:

package p

var _ = map[int]int{0: 0, 0: 0}

cmd/compile and go/types correctly emit an error.

/cc @ianlancetaylor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment