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

cmd/compile: spurious error for goto jumping over non-var declarations #13521

Closed
momchil-velikov opened this issue Dec 7, 2015 · 5 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@momchil-velikov
Copy link
Contributor

The compiler issues an error message for a goto jumping over type or const declaration, like

package main

func main() {
    goto L1
    type A int
L1:
}

The specification forbids only jumping over variable declarations.

@bradfitz
Copy link
Contributor

bradfitz commented Dec 7, 2015

@ianlancetaylor
Copy link
Contributor

Fails on gccgo as well:

/home/iant/foo.go:4:5: error: goto jumps over declaration of ‘A’
     goto L1
     ^
/home/iant/foo.go:5:10: note: ‘A’ defined here
     type A int
          ^

@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Dec 7, 2015
@bradfitz
Copy link
Contributor

bradfitz commented Dec 7, 2015

Passes with gotypes.

@rsc rsc changed the title cmd/compile: The compiler issues an error message for a goto jumping over type or const declaration cmd/compile: spurious error for goto jumping over non-var declarations May 17, 2016
@rsc rsc modified the milestones: Go1.8, Go1.7 May 17, 2016
@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 11, 2016
@rsc rsc modified the milestones: Go1.9, Go1.8 Oct 21, 2016
@ALTree
Copy link
Member

ALTree commented Jan 9, 2017

Exact dup of #8042.

Also see the old thread for a tentative fix (it was reverted but maybe it's salvageable).

@mdempsky
Copy link
Member

Closing as duplicate of #8042.

@golang golang locked and limited conversation to collaborators Feb 15, 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

8 participants