-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
What version of Go are you using (go version)?
$ go version go version go1.20.3 linux/amd64
Does this issue reproduce with the latest release?
Yes
What did you do?
package main
type I interface {
M(int)
P()
}
type V int
func (v V) P() { println(v) }
func (v *V) M(n int) { *v = V(n) }
type S struct{ *V }
func F[T I](x T) {
defer x.P()
x.M(9)
}
func G(x *S) {
defer x.P()
x.M(9)
}
func main() {
{
var s = S{V: new(V)}
F(&s) // 9
}
{
var s = S{V: new(V)}
G(&s) // 0
}
}What did you expect to see?
Same behavior.
What did you see instead?
Different behavior.
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
Todo