-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: goto over type/const declarations is erroneously rejected #19088
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
Comments
Also, go/types accepts the test case. |
Can't we argue that there is a scope between "out:" and "}" ? |
@dr2chase Sorry, I'm not sure I understand your question. The Go spec forbids gotos that jump over variable declarations such as:
The issue is that cmd/compile (and gccgo) are also rejecting gotos that jump over type and constant declarations. |
Ah, oops, never mind. |
Probably not urgent since we lived with this forever. Yet also safe to fix because it will be backward-compatible with existing code (it's lifting a restriction). |
The Go spec (section "Goto statements") says "Executing the "goto" statement must not cause any variables to come into scope that were not already in scope at the point of the goto."
cmd/compile erroneously rejects this code:
with
The text was updated successfully, but these errors were encountered: