|
34 | 34 | \nontermdef{condition}\br
|
35 | 35 | expression\br
|
36 | 36 | \opt{attribute-specifier-seq} decl-specifier-seq declarator brace-or-equal-initializer
|
| 37 | + structured-binding-declaration initializer |
37 | 38 | \end{bnf}
|
38 | 39 |
|
39 | 40 | The optional \grammarterm{attribute-specifier-seq} appertains to the respective statement.
|
|
86 | 87 | The rules for \grammarterm{condition}{s} apply both
|
87 | 88 | to \grammarterm{selection-statement}{s}\iref{stmt.select} and
|
88 | 89 | to the \keyword{for} and \keyword{while} statements\iref{stmt.iter}.
|
89 |
| -A \grammarterm{condition} that is not an \grammarterm{expression} is a |
90 |
| -declaration\iref{dcl.dcl}. |
| 90 | +If a \grammarterm{structured-binding-declaration} |
| 91 | +appears in a \grammarterm{condition}, |
| 92 | +the \grammarterm{condition} is a structured binding declaration\iref{dcl.pre}. |
| 93 | +A \grammarterm{condition} that is |
| 94 | +neither an \grammarterm{expression} nor a structured binding declaration |
| 95 | +is a declaration\iref{dcl.dcl}. |
91 | 96 | The \grammarterm{declarator} shall not
|
92 | 97 | specify a function or an array. The \grammarterm{decl-specifier-seq} shall not
|
93 | 98 | define a class or enumeration. If the \keyword{auto} \grammarterm{type-specifier} appears in
|
94 | 99 | the \grammarterm{decl-specifier-seq},
|
95 | 100 | the type of the identifier being declared is deduced from the initializer as described in~\ref{dcl.spec.auto}.
|
96 | 101 |
|
97 | 102 | \pnum
|
98 |
| -The value of a \grammarterm{condition} that is an initialized declaration |
| 103 | +The \defn{decision variable} of a \grammarterm{condition} |
| 104 | +that is neither an \grammarterm{expression} nor a structured binding declaration |
| 105 | +is the declared variable. |
| 106 | +The decision variable of a \grammarterm{condition} |
| 107 | +that is a structured binding declaration is specified in\iref{dcl.struct.bind}. |
| 108 | + |
| 109 | +\pnum |
| 110 | +The value of a \grammarterm{condition} that not an \grammarterm{expression} |
99 | 111 | in a statement other than a \keyword{switch} statement is the value of the
|
100 |
| -declared variable |
| 112 | +decision variable |
101 | 113 | contextually converted to \tcode{bool}\iref{conv}.
|
102 | 114 | If that
|
103 | 115 | conversion is ill-formed, the program is ill-formed.
|
|
116 | 128 | it is interpreted as the latter.
|
117 | 129 |
|
118 | 130 | \pnum
|
119 |
| -In the \grammarterm{decl-specifier-seq} of a \grammarterm{condition}, each |
| 131 | +In the \grammarterm{decl-specifier-seq} of a \grammarterm{condition}, |
| 132 | +including that of any \grammarterm{structured-binding-declaration} of |
| 133 | +the \grammarterm{condition}, |
| 134 | +each |
120 | 135 | \grammarterm{decl-specifier} shall be either a \grammarterm{type-specifier}
|
121 | 136 | or \keyword{constexpr}.
|
122 | 137 |
|
|
408 | 423 | several statements depending on the value of a condition.
|
409 | 424 |
|
410 | 425 | \pnum
|
411 |
| -The value of a \grammarterm{condition} |
412 |
| -that is an initialized declaration |
413 |
| -is the value of the declared variable, |
414 |
| -or the value of the \grammarterm{expression} otherwise. |
| 426 | +If the \grammarterm{condition} is an \grammarterm{expression}, |
| 427 | +the value of the condition is the value of the \grammarterm{expression}; |
| 428 | +otherwise, it is the value of the decision variable. |
415 | 429 | The value of the condition shall be of integral type, enumeration type, or class
|
416 | 430 | type. If of class type, the
|
417 | 431 | condition is contextually implicitly converted\iref{conv} to
|
|
0 commit comments