Skip to content

cmd/compile: spurious "goto label jumps over declaration" #8042

@dvyukov

Description

@dvyukov
go version devel +4a839bf01b58 Tue May 20 15:52:08 2014 +1000 + linux/amd64

The program is:
package main
func main() {
    goto label
    type X int
    label:
}

$ go build goto.go
goto.go:3: goto label jumps over declaration of X at goto.go:4

The spec only requires new variables to not come into scope:
"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".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions