@@ -262,16 +262,14 @@ $(GNAME ElseStatement):
262
262
$(P If there is a declared *Identifier* variable,
263
263
$(RELATIVE_LINK2 condition-variables, it is evaluated).
264
264
Otherwise, *Expression* is evaluated. The result is converted to a
265
- boolean.
266
- If the boolean is `true`, the $(I ThenStatement) is transferred
265
+ boolean.)
266
+
267
+ $(P If the boolean is `true`, the $(I ThenStatement) is transferred
267
268
to, otherwise the $(I ElseStatement) is transferred to.)
268
269
269
270
$(P The $(I ElseStatement) is associated with the innermost `if`
270
271
statement which does not already have an associated $(I ElseStatement).)
271
272
272
- $(P If both, `auto` and `ref` are present, the variable is a reference
273
- if and only if the *Expression* is an lvalue.)
274
-
275
273
$(H3 $(LNAME2 boolean-conditions, Boolean Conversion))
276
274
277
275
$(P The following type instances are supported in a condition:)
@@ -296,18 +294,28 @@ $(H3 $(LNAME2 condition-variables, Condition Variables))
296
294
$(P
297
295
When an $(I Identifier) form of *IfCondition* is used, a
298
296
variable is declared with that name and initialized to the
299
- value of the * Expression* .
297
+ value of the $(I Expression) .
300
298
)
301
299
302
- * If $(D auto) $(I Identifier) is provided, the type of the variable
303
- is the same as *Expression*.
300
+ * If both `auto` and `ref` are present among $(I IfConditionStorageClasses),
301
+ the variable is a reference
302
+ if and only if the $(I Expression) is an lvalue;
303
+
304
+ * If `ref` is present without `auto`,
305
+ the variable is a reference and $(I Expression) must be an lvalue.
304
306
305
- * If $(I TypeCtors) $(I Identifier) is provided, the variable is
306
- declared to be the type of *Expression* but with $(I TypeCtors) applied.
307
+ * If `auto` is present without `ref`, the type of the variable
308
+ is the same as $(I Expression).
309
+ The presence of `auto` in combination with any $(I IfConditionStorageClasses)
310
+ except `ref` (cf. first bullet point)
311
+ has no effect.
312
+ Only if no other $(I IfConditionStorageClasses) are meaningful,
313
+ `auto` provides an option to declare a variable.
314
+ Using `auto` without `ref` when $(I BasicType) is given is not allowed.
307
315
308
- * If the $(I BasicType) form is provided, it declares the type of the
309
- variable as it would for a normal
310
- $(DDSUBLINK spec/declaration, variable-declarations, variable declaration).
316
+ * If $(I TypeCtors) are provided and possibly the $(I BasicType) is given,
317
+ the variable is declared as it would for a normal
318
+ $(DDSUBLINK spec/declaration, variable-declarations, variable declaration).
311
319
312
320
$(P The scope of the variable is the *ThenStatement* only.)
313
321
@@ -357,18 +365,7 @@ while (i < 10)
357
365
}
358
366
---
359
367
360
- $(P If an $(D auto) $(I Identifier) is provided, it is declared and
361
- initialized to the value and type of the *Expression*. Its scope
362
- extends from when it is initialized to the end of the *ScopeStatement*.)
363
-
364
- $(P If a $(I TypeCtors) $(I Identifier) is provided, it is declared
365
- to be of the type specified by $(I TypeCtors) and is initialized with
366
- the value of the *Expression*. Its scope extends from when it is
367
- initialized to the end of the *ScopeStatement*.)
368
-
369
- $(P If a $(I Declarator) is provided, it is declared and initialized
370
- to the value of the *Expression*. Its scope extends from when it is
371
- initialized to the end of the *ScopeStatement*.)
368
+ $(P If the $(I IfCondition) declares a variable, $(RELATIVE_LINK2 condition-variables, it is initialized and evaluated) on every loop iteration.)
372
369
373
370
$(P A $(GLINK BreakStatement) will exit the loop.)
374
371
0 commit comments