@@ -404,7 +404,8 @@ $(GNAME ConditionalExpression):
404404 the result type of the conditional expression.
405405 )
406406
407- $(P $(B Note:)
407+ $(PANEL
408+ $(NOTE
408409 When a conditional expression is the left operand of
409410 an $(RELATIVE_LINK2 assign_expressions, assign expression),
410411 parentheses are required for disambiguation:
@@ -413,8 +414,8 @@ $(GNAME ConditionalExpression):
413414 bool test;
414415 int a, b, c;
415416 ...
416- test ? a = b : c = 2; // Deprecated
417- (test ? a = b : c) = 2; // Equivalent
417+ test ? a = b : c = 2; // error
418+ (test ? a = b : c) = 2; // OK
418419 ---
419420
420421 $(P This makes the intent clearer, because the first statement can
@@ -423,6 +424,7 @@ $(GNAME ConditionalExpression):
423424 ---
424425 test ? a = b : (c = 2);
425426 ---
427+ )
426428
427429$(H2 $(LNAME2 logical_expressions, Logical Expressions))
428430
@@ -494,6 +496,25 @@ $(H2 $(LNAME2 bitwise_expressions, Bitwise Expressions))
494496 )
495497 $(DDOC_SEE_ALSO $(GLINK ShiftExpression), $(GLINK ComplementExpression))
496498
499+ $(PANEL
500+ $(NOTE If an *OrExpression*, *XorExpression* or *AndExpression* appears on
501+ either side of an *EqualExpression*, *IdentityExpression* or *RelExpression*,
502+ it is a compile error. Instead, disambiguate by using parentheses.
503+ )
504+
505+ $(SPEC_RUNNABLE_EXAMPLE_FAIL
506+ ---
507+ int x, a, b;
508+ x = a & 5 == b; // error
509+ x = a & 5 is b; // error
510+ x = a & 5 <= b; // error
511+
512+ x = (a & 5) == b; // OK
513+ x = a & (5 == b); // OK
514+ ---
515+ )
516+ )
517+
497518$(H3 $(LNAME2 or_expressions, Or Expressions))
498519
499520$(GRAMMAR
0 commit comments