tmp/tmpoc7pju_2/{from.md → to.md}
RENAMED
|
@@ -1,17 +1,20 @@
|
|
| 1 |
## Preamble <a id="stmt.pre">[[stmt.pre]]</a>
|
| 2 |
|
| 3 |
-
Except as indicated, statements are executed in sequence
|
|
|
|
| 4 |
|
| 5 |
``` bnf
|
| 6 |
statement:
|
| 7 |
labeled-statement
|
| 8 |
attribute-specifier-seqₒₚₜ expression-statement
|
| 9 |
attribute-specifier-seqₒₚₜ compound-statement
|
| 10 |
attribute-specifier-seqₒₚₜ selection-statement
|
| 11 |
attribute-specifier-seqₒₚₜ iteration-statement
|
|
|
|
| 12 |
attribute-specifier-seqₒₚₜ jump-statement
|
|
|
|
| 13 |
declaration-statement
|
| 14 |
attribute-specifier-seqₒₚₜ try-block
|
| 15 |
```
|
| 16 |
|
| 17 |
``` bnf
|
|
@@ -23,60 +26,85 @@ init-statement:
|
|
| 23 |
|
| 24 |
``` bnf
|
| 25 |
condition:
|
| 26 |
expression
|
| 27 |
attribute-specifier-seqₒₚₜ decl-specifier-seq declarator brace-or-equal-initializer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
```
|
| 29 |
|
| 30 |
The optional *attribute-specifier-seq* appertains to the respective
|
| 31 |
-
statement.
|
|
|
|
| 32 |
|
| 33 |
A *substatement* of a *statement* is one of the following:
|
| 34 |
|
| 35 |
- for a *labeled-statement*, its *statement*,
|
| 36 |
- for a *compound-statement*, any *statement* of its *statement-seq*,
|
| 37 |
- for a *selection-statement*, any of its *statement*s or
|
| 38 |
-
*compound-statement*s (but not its *init-statement*),
|
| 39 |
- for an *iteration-statement*, its *statement* (but not an
|
|
|
|
|
|
|
| 40 |
*init-statement*).
|
| 41 |
|
| 42 |
[*Note 1*: The *compound-statement* of a *lambda-expression* is not a
|
| 43 |
substatement of the *statement* (if any) in which the
|
| 44 |
*lambda-expression* lexically appears. — *end note*]
|
| 45 |
|
| 46 |
A *statement* `S1` *encloses* a *statement* `S2` if
|
| 47 |
|
| 48 |
- `S2` is a substatement of `S1`,
|
| 49 |
-
- `S1` is a *selection-statement*
|
| 50 |
-
the *init-statement* of `S1`,
|
| 51 |
- `S1` is a *try-block* and `S2` is its *compound-statement* or any of
|
| 52 |
the *compound-statement*s of its *handler*s, or
|
| 53 |
- `S1` encloses a statement `S3` and `S3` encloses `S2`.
|
| 54 |
|
| 55 |
A statement `S1` is *enclosed by* a statement `S2` if `S2` encloses
|
| 56 |
`S1`.
|
| 57 |
|
| 58 |
The rules for *condition*s apply both to *selection-statement*s
|
| 59 |
-
[[stmt.select]] and to the `for` and `while` statements [[stmt.iter]].
|
| 60 |
-
*
|
| 61 |
-
|
| 62 |
-
*
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
The
|
| 68 |
-
|
| 69 |
-
variable
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
is
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
If a *condition* can be syntactically resolved as either an expression
|
| 78 |
or a declaration, it is interpreted as the latter.
|
| 79 |
|
| 80 |
-
In the *decl-specifier-seq* of a *condition*
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
|
|
|
| 1 |
## Preamble <a id="stmt.pre">[[stmt.pre]]</a>
|
| 2 |
|
| 3 |
+
Except as indicated, statements are executed in sequence
|
| 4 |
+
[[intro.execution]].
|
| 5 |
|
| 6 |
``` bnf
|
| 7 |
statement:
|
| 8 |
labeled-statement
|
| 9 |
attribute-specifier-seqₒₚₜ expression-statement
|
| 10 |
attribute-specifier-seqₒₚₜ compound-statement
|
| 11 |
attribute-specifier-seqₒₚₜ selection-statement
|
| 12 |
attribute-specifier-seqₒₚₜ iteration-statement
|
| 13 |
+
attribute-specifier-seqₒₚₜ expansion-statement
|
| 14 |
attribute-specifier-seqₒₚₜ jump-statement
|
| 15 |
+
attribute-specifier-seqₒₚₜ assertion-statement
|
| 16 |
declaration-statement
|
| 17 |
attribute-specifier-seqₒₚₜ try-block
|
| 18 |
```
|
| 19 |
|
| 20 |
``` bnf
|
|
|
|
| 26 |
|
| 27 |
``` bnf
|
| 28 |
condition:
|
| 29 |
expression
|
| 30 |
attribute-specifier-seqₒₚₜ decl-specifier-seq declarator brace-or-equal-initializer
|
| 31 |
+
structured-binding-declaration initializer
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
``` bnf
|
| 35 |
+
for-range-declaration:
|
| 36 |
+
attribute-specifier-seqₒₚₜ decl-specifier-seq declarator
|
| 37 |
+
structured-binding-declaration
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
``` bnf
|
| 41 |
+
for-range-initializer:
|
| 42 |
+
expr-or-braced-init-list
|
| 43 |
```
|
| 44 |
|
| 45 |
The optional *attribute-specifier-seq* appertains to the respective
|
| 46 |
+
statement. See [[dcl.meaning]] for the optional
|
| 47 |
+
*attribute-specifier-seq* in a *for-range-declaration*.
|
| 48 |
|
| 49 |
A *substatement* of a *statement* is one of the following:
|
| 50 |
|
| 51 |
- for a *labeled-statement*, its *statement*,
|
| 52 |
- for a *compound-statement*, any *statement* of its *statement-seq*,
|
| 53 |
- for a *selection-statement*, any of its *statement*s or
|
| 54 |
+
*compound-statement*s (but not its *init-statement*),
|
| 55 |
- for an *iteration-statement*, its *statement* (but not an
|
| 56 |
+
*init-statement*), or
|
| 57 |
+
- for an *expansion-statement*, its *compound-statement* (but not an
|
| 58 |
*init-statement*).
|
| 59 |
|
| 60 |
[*Note 1*: The *compound-statement* of a *lambda-expression* is not a
|
| 61 |
substatement of the *statement* (if any) in which the
|
| 62 |
*lambda-expression* lexically appears. — *end note*]
|
| 63 |
|
| 64 |
A *statement* `S1` *encloses* a *statement* `S2` if
|
| 65 |
|
| 66 |
- `S2` is a substatement of `S1`,
|
| 67 |
+
- `S1` is a *selection-statement*, *iteration-statement*, or
|
| 68 |
+
*expansion-statement*, and `S2` is the *init-statement* of `S1`,
|
| 69 |
- `S1` is a *try-block* and `S2` is its *compound-statement* or any of
|
| 70 |
the *compound-statement*s of its *handler*s, or
|
| 71 |
- `S1` encloses a statement `S3` and `S3` encloses `S2`.
|
| 72 |
|
| 73 |
A statement `S1` is *enclosed by* a statement `S2` if `S2` encloses
|
| 74 |
`S1`.
|
| 75 |
|
| 76 |
The rules for *condition*s apply both to *selection-statement*s
|
| 77 |
+
[[stmt.select]] and to the `for` and `while` statements [[stmt.iter]].
|
| 78 |
+
If a *structured-binding-declaration* appears in a *condition*, the
|
| 79 |
+
*condition* is a structured binding declaration [[dcl.pre]]. A
|
| 80 |
+
*condition* that is neither an *expression* nor a structured binding
|
| 81 |
+
declaration is a declaration [[dcl]]. The *declarator* shall not specify
|
| 82 |
+
a function or an array. The *decl-specifier-seq* shall not define a
|
| 83 |
+
class or enumeration. If the `auto` *type-specifier* appears in the
|
| 84 |
+
*decl-specifier-seq*, the type of the identifier being declared is
|
| 85 |
+
deduced from the initializer as described in [[dcl.spec.auto]].
|
| 86 |
|
| 87 |
+
The *decision variable* of a *condition* that is neither an *expression*
|
| 88 |
+
nor a structured binding declaration is the declared variable. The
|
| 89 |
+
decision variable of a *condition* that is a structured binding
|
| 90 |
+
declaration is specified in [[dcl.struct.bind]].
|
| 91 |
+
|
| 92 |
+
The value of a *condition* that is not an *expression* in a statement
|
| 93 |
+
other than a `switch` statement is the value of the decision variable
|
| 94 |
+
contextually converted to `bool` [[conv]]. If that conversion is
|
| 95 |
+
ill-formed, the program is ill-formed. The value of a *condition* that
|
| 96 |
+
is an expression is the value of the expression, contextually converted
|
| 97 |
+
to `bool` for statements other than `switch`; if that conversion is
|
| 98 |
+
ill-formed, the program is ill-formed. The value of the condition will
|
| 99 |
+
be referred to as simply “the condition” where the usage is unambiguous.
|
| 100 |
|
| 101 |
If a *condition* can be syntactically resolved as either an expression
|
| 102 |
or a declaration, it is interpreted as the latter.
|
| 103 |
|
| 104 |
+
In the *decl-specifier-seq* of a *condition* or of a
|
| 105 |
+
*for-range-declaration*, including that of any
|
| 106 |
+
*structured-binding-declaration* of the *condition*, each
|
| 107 |
+
*decl-specifier* shall be either a *type-specifier* or `constexpr`. The
|
| 108 |
+
*decl-specifier-seq* of a *for-range-declaration* shall not define a
|
| 109 |
+
class or enumeration.
|
| 110 |
|