File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,28 @@ $(GNAME ConditionalExpression):
165
165
the result type of the conditional expression.
166
166
)
167
167
168
+ $(P $(B Note:)
169
+ When a conditional expression is the left operand of
170
+ an $(RELATIVE_LINK2 assign_expressions, assign expression), they would be
171
+ parsed as an assignment to $(I the result) of the conditional. This
172
+ has now been deprecated. To preserve the existing behaviour, add
173
+ parentheses for the conditional without including the assignment:
174
+ )
175
+ ---
176
+ bool test;
177
+ int a, b, c;
178
+ ...
179
+ test ? a = b : c = 2; // Deprecated
180
+ (test ? a = b : c) = 2; // Equivalent
181
+ ---
182
+
183
+ $(P This makes the intent clearer, because the first statement can
184
+ easily be misread as the following code:
185
+ )
186
+ ---
187
+ test ? a = b : (c = 2);
188
+ ---
189
+
168
190
$(H2 $(LNAME2 oror_expressions, OrOr Expressions))
169
191
170
192
$(GRAMMAR
You can’t perform that action at this time.
0 commit comments