Skip to content
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

Open
mdempsky opened this issue Oct 9, 2018 · 3 comments

Comments

@mdempsky
Copy link
Member

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

@gopherbot

This comment has been minimized.

Copy link

commented Feb 6, 2019

Change https://golang.org/cl/161357 mentions this issue: compiler: check duplicate keys in map literal

@gopherbot

This comment has been minimized.

Copy link

commented Feb 6, 2019

Change https://golang.org/cl/161357 mentions this issue: compiler: check duplicate keys in map composite literal

gopherbot pushed a commit to golang/gofrontend that referenced this issue Feb 14, 2019
compiler: check duplicate string keys in map composite literals
Updates golang/go#28104

Change-Id: I9f313245b10d4a25549c1099b76eba96e775a0f6
Reviewed-on: https://go-review.googlesource.com/c/161357
Reviewed-by: Ian Lance Taylor <iant@golang.org>
kraj pushed a commit to kraj/gcc that referenced this issue Feb 15, 2019
ian
compiler: check duplicate string keys in map composite literals
    
    Updates golang/go#28104
    
    Reviewed-on: https://go-review.googlesource.com/c/161357


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268891 138bc75d-0d04-0410-961f-82ee72b054a4
@gopherbot

This comment has been minimized.

Copy link

commented Feb 27, 2019

Change https://golang.org/cl/162882 mentions this issue: compiler: check duplicate numeric keys in map literals

gopherbot pushed a commit to golang/gofrontend that referenced this issue Feb 27, 2019
compiler: check duplicate numeric keys in map literals
Updates golang/go#28104

Change-Id: Ic31cdf29721d37529ade9c3cd00efa279cb2066f
Reviewed-on: https://go-review.googlesource.com/c/162882
Reviewed-by: Ian Lance Taylor <iant@golang.org>
kraj pushed a commit to kraj/gcc that referenced this issue Feb 27, 2019
ian
compiler: check duplicate numeric keys in map literals
    
    Updates golang/go#28104
    
    Reviewed-on: https://go-review.googlesource.com/c/162882


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269242 138bc75d-0d04-0410-961f-82ee72b054a4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.