-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/compile: iota inside function in a ConstSpec is not accepted #22344
Comments
Not urgent in any way but marked as 1.10 so it doesn't slip from the radar. Might be an easy fix. |
There is a paradox package main
import "unsafe"
const (
i = 1
j
k
x = unsafe.Sizeof(func() {const a = iota; var _ [a-2]int }) // a is 0 or 3?
y
z
)
func main() {
} The current gc thinks |
|
@go101 This "paradox" was addressed with the most recent changes for #15550. The value of |
Change https://golang.org/cl/194717 mentions this issue: |
https://play.golang.org/p/K0Vga-Y1fv reports an error, but the spec doesn't prohibit this code.
https://play.golang.org/p/MbPQO9FJku is accepted, and there is no reason why the former, with iota being declared in the universe block shouldn't also be accepted within the constant declaration.
The text was updated successfully, but these errors were encountered: