8
Statements
[stmt.stmt]
8.2
Labeled statement
[stmt.label]
1
#
A statement can be labeled
.
labeled-statement
:
attribute-specifier-seq
o
p
t
identifier
:
statement
attribute-specifier-seq
o
p
t
case
constant-expression
:
statement
attribute-specifier-seq
o
p
t
default
:
statement
The optional
attribute-specifier-seq
appertains to the label
.
An
identifier label
declares the identifier
.
The only use of an identifier label is as the target of a
goto
.
The scope of a label is the function in which it appears
.
Labels shall not be redeclared within a function
.
A label can be used in a
goto
statement before its declaration
.
Labels have their own name space and do not interfere with other identifiers
.
[
Note
:
A label may have the same name as another declaration in the same scope or a
template-parameter
from an enclosing scope
.
Unqualified name lookup
ignores labels
.
—
end note
]
2
#
Case labels and default labels shall occur only in
switch
statements
.