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
$ go version
go version devel go1.18-00d6d2037e Thu Nov 4 14:54:46 2021 +0000 linux/amd64
What did you do?
This is similar to #49295 in that it falls afoul to the recently enforced rule, but worked in previous heads.
The conversion rule seems too strict on integer types.
package main
import"constraints"funcSizeOf[T constraints.Integer]() int {
return1+int(T(1<<8))>>8+int(T(2<<16))>>16+int(T(4<<32))>>32
}
funcIsSigned[T constraints.Integer]() bool {
returnT(-1) <0
}
What did you expect to see?
Successful compilation
What did you see instead?
# command-line-arguments
./main.go:6:19: cannot convert 1 << 16 (untyped int value) to T
cannot convert 1 << 16 (untyped int constant 65536) to int8 (in T)
./main.go:6:38: cannot convert 2 << 16 (untyped int value) to T
cannot convert 2 << 16 (untyped int constant 131072) to int8 (in T)
./main.go:6:58: cannot convert 4 << 32 (untyped int value) to T
cannot convert 4 << 32 (untyped int constant 17179869184) to int8 (in T)
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?What did you do?
This is similar to #49295 in that it falls afoul to the recently enforced rule, but worked in previous heads.
The conversion rule seems too strict on integer types.
What did you expect to see?
Successful compilation
What did you see instead?
The text was updated successfully, but these errors were encountered: