8 Statements [stmt.stmt]

8.1 Preamble [stmt.pre]

Except as indicated, statements are executed in sequence.
The optional attribute-specifier-seq appertains to the respective statement.
A substatement of a statement is one of the following:
[Note 1:
The compound-statement of a lambda-expression is not a substatement of the statement (if any) in which the lambda-expression lexically appears.
— end note]
A statement S1 encloses a statement S2 if
The rules for conditions apply both to selection-statements and to the for and while statements ([stmt.iter]).
A condition that is not an expression is a declaration ([dcl.dcl]).
The declarator shall not specify a function or an array.
The decl-specifier-seq shall not define a class or enumeration.
If the auto type-specifier appears in the decl-specifier-seq, the type of the identifier being declared is deduced from the initializer as described in [dcl.spec.auto].
[Note 2:
A name introduced in a selection-statement or iteration-statement outside of any substatement is in scope from its point of declaration until the end of the statement's substatements.
Such a name cannot be redeclared in the outermost block of any of the substatements ([basic.scope.block]).
— end note]
The value of a condition that is an initialized declaration in a statement other than a switch statement is the value of the declared variable contextually converted to bool.
If that conversion is ill-formed, the program is ill-formed.
The value of a condition that is an initialized declaration in a switch statement is the value of the declared variable if it has integral or enumeration type, or of that variable implicitly converted to integral or enumeration type otherwise.
The value of a condition that is an expression is the value of the expression, contextually converted to bool for statements other than switch; if that conversion is ill-formed, the program is ill-formed.
The value of the condition will be referred to as simply “the condition” where the usage is unambiguous.
If a condition can be syntactically resolved as either an expression or the declaration of a block-scope name, it is interpreted as a declaration.
In the decl-specifier-seq of a condition, each decl-specifier shall be either a type-specifier or constexpr.