int x = 0;
int y = 0;
(1 ? x : y) = 4;
This is not legal in ANSI C:
If an attempt is made to modify the result of a conditional operator
or to access it after the next sequence point, the behavior is undefined.
However, in C++ we have:
If the second and third operands are lvalues and have the same type,5.16/5
the result is of that type and is an lvalue.
Otherwise, the result is an rvalue.
via linkedin.com, cpptrivia.blogspot.com