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 composite literals of pointer type #46447

Open
mdempsky opened this issue May 29, 2021 · 1 comment
Open

gccgo: erroneously accepts composite literals of pointer type #46447

mdempsky opened this issue May 29, 2021 · 1 comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mdempsky
Copy link
Member

The Go spec says "The LiteralType's underlying type must be a struct, array, slice, or map type (the grammar enforces this constraint except when the type is given as a TypeName)."

cmd/compile and go/types report "invalid composite literal type" for all four pointer-typed composite literals, but gccgo 10.2.1 accepts them:

package main

type S struct{}

type A *S
type B = *S
type C *struct{}
type D = *struct{}

var (
	_ = A{}
	_ = B{}
	_ = C{}
	_ = D{}
)

/cc @ianlancetaylor

@mdempsky mdempsky added the NeedsFix The path to resolution is known, but the work has not been done. label May 29, 2021
@mdempsky mdempsky added this to the Gccgo milestone May 29, 2021
@gopherbot
Copy link

Change https://golang.org/cl/323314 mentions this issue: test: fix error check messages for 2 types2 tests

gopherbot pushed a commit that referenced this issue Jun 2, 2021
Many compiler tests fail with -G=3 due to changes in error message format.
This commit fixes two of these tests, to ensure I am on the right track in review.

Updates #46447

Change-Id: I138956d536a1d48ca9198e6ddbfde13865bb5dd5
GitHub-Last-Rev: 0ed904b
GitHub-Pull-Request: #46445
Reviewed-on: https://go-review.googlesource.com/c/go/+/323314
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants