runtime: empty struct type pointer comparison varies #73201
Labels
BugReport
Issues describing a possible bug in the Go implementation.
compiler/runtime
Issues related to the Go compiler and/or runtime.
Uh oh!
There was an error while loading. Please reload this page.
Go version
go version go1.24.2 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
Two instances of pointers to an empty struct compare differently based on, as far as I can tell, whether they have been read before.
https://go.dev/play/p/dVDP0x-H5WH
vs.
https://go.dev/play/p/T9ZMpBqgad8
What did you see happen?
In the first example the struct pointers compare
false
. In the second example they comparetrue
.What did you expect to see?
I would have expected the comparison to have the same result regardless of the print statement.
The text was updated successfully, but these errors were encountered: