https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70744

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
So build_conditional_expr_1 has

 4626   /* As a G++ extension, the second argument to the conditional can be
 4627      omitted.  (So that `a ? : c' is roughly equivalent to `a ? a :
 4628      c'.)  If the second operand is omitted, make sure it is
 4629      calculated only once.  */
 4630   if (!arg2)
 4631     {
 ...
 4636       /* Make sure that lvalues remain lvalues.  See g++.oliva/ext1.C. 
*/
 4637       if (real_lvalue_p (arg1))
 4638         arg2 = arg1 = stabilize_reference (arg1);
 4639       else
 4640         arg2 = arg1 = save_expr (arg1);
 4641     }

for preincrement_expr is real_lvalue_p true, so we go to stabilize_reference,
that should ensure that we can use the expr more times without causing its
operands to be evaluated more than once, but it doesn't know
{PRE,POST}{INCR,DECR}EMENT so does nothing:
 4258       /* If arg isn't a kind of lvalue we recognize, make no change.
 4259          Caller should recognize the error for an invalid lvalue.  */
 4260     default:
 4261       return ref;

Reply via email to