Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types: accepts make([]int, 1<<s + 1.1) #21727

Closed
griesemer opened this issue Sep 1, 2017 · 2 comments
Closed

go/types: accepts make([]int, 1<<s + 1.1) #21727

griesemer opened this issue Sep 1, 2017 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

The program

package p
var s uint
var a = make([]int, 1<<s + 1.2)  // <<< 1.2 truncated to integer!
var _ = a[1<<s - 2.3]            // <<< 2.3 truncated to integer!

is accepted by go/types without error.

@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Sep 1, 2017
@griesemer griesemer added this to the Go1.10 milestone Sep 1, 2017
@griesemer griesemer self-assigned this Sep 1, 2017
@griesemer
Copy link
Contributor Author

Simpler repro case:

package p
var s uint
var _ int = 1<<s + 1.2

@gopherbot
Copy link

Change https://golang.org/cl/65370 mentions this issue: go/types: refuse incorrect shift expressions in certain contexts

@golang golang locked and limited conversation to collaborators Sep 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants