Skip to content

Commit 1d44af8

Browse files
committed
Add rule for goto
1 parent cc2d6ad commit 1d44af8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

standard/statements.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,9 @@ A local function is declared at block scope, and that function may capture varia
519519
520520
When the type of `this` is a struct type, it is a compile-time error for the body of a local function to access `this`. This is true whether the access is explicit (as in `this.x`) or implicit (as in `x` where `x` is an instance member of the struct). This rule only prohibits such access and does not affect whether member lookup results in a member of the struct.
521521
522-
> *Note*: this rule mirrors the rule for anonymous functions in12.19.3](expressions.md#12193-anonymous-function-bodies). *end note*
522+
It is a compile-time error for the body of the local function to contain a `goto` statement, a `break` statement, or a `continue` statement whose target is outside the body of the local function.
523+
524+
> *Note*: the above rules for `this` and `goto` mirror the rules for anonymous functions in12.19.3](expressions.md#12193-anonymous-function-bodies). *end note*
523525
524526
A local function may be called from a lexical point prior to its declaration. However, it is a compile-time error for the function to be declared lexically prior to the declaration of a variable used in the local function ([§7.7](basic-concepts.md#77-scopes)).
525527

0 commit comments

Comments
 (0)