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
Assignees
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Sep 1, 2017

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 this to the Go1.10 milestone Sep 1, 2017
@griesemer griesemer self-assigned this Sep 1, 2017
@griesemer
Copy link
Contributor Author

@griesemer griesemer commented Sep 22, 2017

Simpler repro case:

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

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 22, 2017

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

Loading

@gopherbot gopherbot closed this in 45395b5 Sep 25, 2017
@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.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants