Why the following code works without overflow bug?: (overflow bug with uint64 type, if overflow happens in function)
package main
func foo(i uint64) int{
return (1 << i)
}
func main() {
foo(99)
}
A simple bar := 1 << 99
would cause a bug. if you put bar := 1 << 99
you get prog.go:11:9: constant 633825300114114700748351602688 overflows int
.
And bar := 1 << 512
gives prog.go:11:11: shift count too large: 512