From Jason Turner

[stmt.pre]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpk4805lxr/{from.md → to.md} +26 -27
tmp/tmpk4805lxr/{from.md → to.md} RENAMED
@@ -10,74 +10,73 @@ 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
  init-statement:
17
  expression-statement
18
  simple-declaration
 
 
19
 
 
20
  condition:
21
  expression
22
  attribute-specifier-seqₒₚₜ decl-specifier-seq declarator brace-or-equal-initializer
23
  ```
24
 
25
  The optional *attribute-specifier-seq* appertains to the respective
26
  statement.
27
 
28
  A *substatement* of a *statement* is one of the following:
29
 
30
- - for a *labeled-statement*, its contained *statement*,
31
  - for a *compound-statement*, any *statement* of its *statement-seq*,
32
- - for a *selection-statement*, any of its *statement*s (but not its
33
- *init-statement*), or
34
- - for an *iteration-statement*, its contained *statement* (but not an
35
  *init-statement*).
36
 
37
  [*Note 1*: The *compound-statement* of a *lambda-expression* is not a
38
  substatement of the *statement* (if any) in which the
39
  *lambda-expression* lexically appears. — *end note*]
40
 
41
  A *statement* `S1` *encloses* a *statement* `S2` if
42
 
43
- - `S2` is a substatement of `S1` [[dcl.dcl]],
44
  - `S1` is a *selection-statement* or *iteration-statement* and `S2` is
45
  the *init-statement* of `S1`,
46
  - `S1` is a *try-block* and `S2` is its *compound-statement* or any of
47
  the *compound-statement*s of its *handler*s, or
48
  - `S1` encloses a statement `S3` and `S3` encloses `S2`.
49
 
50
- The rules for *condition*s apply both to *selection-statement*s and to
51
- the `for` and `while` statements [[stmt.iter]]. A *condition* that is
52
- not an *expression* is a declaration [[dcl.dcl]]. The *declarator* shall
53
- not specify a function or an array. The *decl-specifier-seq* shall not
54
- define a class or enumeration. If the `auto` *type-specifier* appears in
55
- the *decl-specifier-seq*, the type of the identifier being declared is
56
- deduced from the initializer as described in  [[dcl.spec.auto]].
57
 
58
- [*Note 2*: A name introduced in a *selection-statement* or
59
- *iteration-statement* outside of any substatement is in scope from its
60
- point of declaration until the end of the statement’s substatements.
61
- Such a name cannot be redeclared in the outermost block of any of the
62
- substatements [[basic.scope.block]]. *end note*]
 
 
 
63
 
64
  The value of a *condition* that is an initialized declaration in a
65
  statement other than a `switch` statement is the value of the declared
66
  variable contextually converted to `bool` [[conv]]. If that conversion
67
  is ill-formed, the program is ill-formed. The value of a *condition*
68
- that is an initialized declaration in a `switch` statement is the value
69
- of the declared variable if it has integral or enumeration type, or of
70
- that variable implicitly converted to integral or enumeration type
71
- otherwise. The value of a *condition* that is an expression is the value
72
- of the expression, contextually converted to `bool` for statements other
73
- than `switch`; if that conversion is ill-formed, the program is
74
- ill-formed. The value of the condition will be referred to as simply
75
- “the condition” where the usage is unambiguous.
76
 
77
  If a *condition* can be syntactically resolved as either an expression
78
- or the declaration of a block-scope name, it is interpreted as a
79
- declaration.
80
 
81
  In the *decl-specifier-seq* of a *condition*, each *decl-specifier*
82
  shall be either a *type-specifier* or `constexpr`.
83
 
 
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
18
  init-statement:
19
  expression-statement
20
  simple-declaration
21
+ alias-declaration
22
+ ```
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*), or
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* or *iteration-statement* and `S2` is
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]]. A
60
+ *condition* that is not an *expression* is a declaration [[dcl.dcl]].
61
+ The *declarator* shall not specify a function or an array. The
62
+ *decl-specifier-seq* shall not define a class or enumeration. If the
63
+ `auto` *type-specifier* appears in the *decl-specifier-seq*, the type of
64
+ the identifier being declared is deduced from the initializer as
65
+ described in  [[dcl.spec.auto]].
66
 
67
  The value of a *condition* that is an initialized declaration in a
68
  statement other than a `switch` statement is the value of the declared
69
  variable contextually converted to `bool` [[conv]]. If that conversion
70
  is ill-formed, the program is ill-formed. The value of a *condition*
71
+ that is an expression is the value of the expression, contextually
72
+ converted to `bool` for statements other than `switch`; if that
73
+ conversion is ill-formed, the program is ill-formed. The value of the
74
+ condition will be referred to as simply “the condition” where the usage
75
+ is unambiguous.
 
 
 
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*, each *decl-specifier*
81
  shall be either a *type-specifier* or `constexpr`.
82