-
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: spurious "goto label jumps over declaration" #8042
Comments
CL https://golang.org/cl/9442 mentions this issue. |
I reverted the fix, since it broke all the builds. |
Too late for Go 1.5. |
At the risk of sounding like a fool: suppose that the next line in
What then? I think this is a problem with the spec, and not the toolchain. |
@IronGopher If the declaration were about a variable X rather than a type, then it would be a correct error. The issue is that it's only an error if variables are coming into scope, not types or constants. The spec is clear. This is a compiler bug. |
CC @griesemer @dvyukov
output is still:
Should new bug be opened ? |
yes |
s/ type X int/ X := 0/ |
Never mind my last comment, your bug still stands even on the latest code @djadala :) |
ok, new issue is #22101 |
Okay hold up though, your program isn't correct and you have made a new variable declaration with goto L
X := 0 A goto shouldn't allow a variable that wasn't already in scope to come into scope. I don't see the bug here. |
@djadala I've commented on the other issue that this isn't a bug, and coincidentally the spec provides a similar example to what you posted Initially I had copied and pasted the original code without checking it, but on a closer look I deduced that this isn't a bug. |
Sorry for noise, |
Not a problem at all @djadala, thank you for checking up on the bug. |
The text was updated successfully, but these errors were encountered: