Closed
Description
The program below should run quietly, but instead it prints:
FAIL: if i != t
FAIL: switch i
FAIL: switch t
Marking as a release blocker, because this seems like a miscompilation bug that users could plausibly actually run into. But I think it might be reasonable to punt fixing it to a point release.
A possible workaround here is to replace each use of t
with any(t)
.
package main
func f[T comparable](i any) {
var t T
if i != t {
println("FAIL: if i != t")
}
switch i {
case t:
// ok
default:
println("FAIL: switch i")
}
switch t {
case i:
// ok
default:
println("FAIL: switch t")
}
}
func main() {
f[int](int(0))
}