------- Comment #13 from mmitchel at gcc dot gnu dot org 2008-09-23 18:38 ------- The C++ WP draft I have (a bit old) says:
If the second and third operands are lvalues and have the same type, the result is of that type and is an lvalue and it is a bit-field if the second or the third operand is a bit-field, or if both are bit-fields. So, I don't see why: > (x ? c.i : a) = y; should not be valid In C++, "type" does not include the number of bits in the bit-field. I think think the expression "x ? c.i : a" is an lvalue bit-field of type "int". On that basis, I think the gimplifier (including C++-specific hooks thereto) should handle converting down to whatever representation GENERIC requires. I'd expect something like: t = SAVE_EXPR (y), x ? (c.i = (int-of-N-bits) t) : (a = t), t We could also do this in the FE proper (before GENERIC) if required; we would fix up the conditional expression after working out whether it's being used as an lvalue or an rvalue. -- mmitchel at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mmitchel at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37146