go/types: can shift complex numbers
dvyukov opened this issue · 5 comments
dvyukov commented
gotype successfully compiles the following program:
package a
var a = complex64(1) << 2
gccgo also compiles it. gc rejects it saying:
invalid operation: complex64(1) << 2 (shift of type complex64)
Spec says that lhs of shift must be an integer.
dvyukov commented
@griesemer if my reading of the spec is correct, then we also need to file a bug on gccgo.
griesemer commented
This is clearly a go/types bug. Should be trivial to fix and probably should be fixed for 1.5.
griesemer commented
The fix is trivial (one missing predicate check). Can safely go in for 1.5 as far as I am concerned.
https://go-review.googlesource.com/#/c/12045/
(includes tests).
gopherbot commented
CL https://golang.org/cl/12045 mentions this issue.
gopherbot commented
CL https://golang.org/cl/12046 mentions this issue.