-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
gccgo incorrectly reports error: incompatible types in binary expression
for this test program:
package main
func main() {
var v uint = 32
println(1 << v == '\002' << v)
}
The Go spec says:
If the left operand of a non-constant shift expression is an untyped constant, it is first implicitly converted to the type it would assume if the shift expression were replaced by its left operand alone.
So 1
and '\002'
should take on the types that they would in the comparison 1 == '\002'
, which is rune
/int32
.
For comparison, the program prints true
when compiled with cmd/compile, and it type checks with go/types.
/cc @ianlancetaylor
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.