-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
Go version
go1.21.4 (playground). Also any version since Go 1.18.
What operating system and processor architecture are you using (go env
)?
N/A
What did you do?
https://go.dev/play/p/_OT3OvSlSeg
package main
type I interface{}
type T struct{ X *I }
var i I
var t = T{i}
func main() {}
Compile this code.
What did you expect to see?
./i.go:7:11: cannot use i (type I) as type *I in field value:
*I is pointer to interface, not interface
This is what Go 1.17 and before emit.
What did you see instead?
./i.go:7:11: cannot use i (variable of type I) as *I value in struct literal: I does not implement *I (type *I is pointer to interface, not interface)
Specifically, it contains I does not implement *I
. In the spec "implements" is only used for implementing an interface or a type constraint. There is no "implementing a pointer to an interface". So this does not implement *I
is confusing. We probably want to remove it.
mauri870
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
In Progress