You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like the compiler might be overoptimising lambda execution by using the variable reference instead of its value. Please see the test case below.
What version of Go are you using (go version)?
$ go version
go version go1.20.1 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
It looks like the compiler might be overoptimising lambda execution by using the variable reference instead of its value. Please see the test case below.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
The following test fails:
What did you expect to see?
Test does not fail
What did you see instead?
Wrong answer! Got 1, want 0.
By the way, it does work correctly if I use an intermediate variable inside the loop, like so:
The text was updated successfully, but these errors were encountered: