Skip to content

go/types, types2: error reported for valid shifts #52080

@griesemer

Description

@griesemer

Extracted from test/shift1.go which is currently not passing (excluded) in 1.18:

package p

func _(x int, s uint) {
	x = (1. << s) << (1 << s)
	x = (1. << s) << (1. << s)
}

reports

x.go:4:6: invalid operation: shifted operand (1. << s) (untyped float value) must be integer
x.go:5:6: invalid operation: shifted operand (1. << s) (untyped float value) must be integer

These should probably be valid. Regression.

cc @findleyr

Metadata

Metadata

Assignees

Labels

NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions