We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f0c63a5 + 3685d36 commit 18f70c4Copy full SHA for 18f70c4
spec/expression.dd
@@ -165,6 +165,26 @@ $(GNAME ConditionalExpression):
165
the result type of the conditional expression.
166
)
167
168
+ $(P $(B Note:)
169
+ When a conditional expression is the left operand of
170
+ an $(RELATIVE_LINK2 assign_expressions, assign expression),
171
+ parentheses are required for disambiguation:
172
+ )
173
+ ---
174
+ bool test;
175
+ int a, b, c;
176
+ ...
177
+ test ? a = b : c = 2; // Deprecated
178
+ (test ? a = b : c) = 2; // Equivalent
179
180
+
181
+ $(P This makes the intent clearer, because the first statement can
182
+ easily be misread as the following code:
183
184
185
+ test ? a = b : (c = 2);
186
187
188
$(H2 $(LNAME2 oror_expressions, OrOr Expressions))
189
190
$(GRAMMAR
0 commit comments