package main
type C interface {
int32
}
func inc[T C](x T) T {
x++
return x
}
func main() {
println(inc(int32(5)))
}
$ go run -gcflags=-G=3 ~/gowork/tmp2.go
# command-line-arguments
../../../gowork/tmp2.go:8:3: invalid operation: x + 1 (mismatched types int32 and int)
../../../gowork/tmp2.go:12:13: invalid operation: x + 1 (mismatched types int32 and int)
I think the 1 introduced by ++ needs to have the type of the LHS.
Not sure why there are two errors also.
@danscales
I think the
1introduced by++needs to have the type of the LHS.Not sure why there are two errors also.
@danscales