On 03/03/2011 11:39 PM, Jason Merrill wrote:
I think rather that the problem is in build_conditional_expr; it
should have a template case that just determines the appropriate
type and then builds up a COND_EXPR with that type from the
unconverted operands, like we do for calls in finish_call_expr.
Thanks for the suggestion. I spent some more time looking into the
related code. If I understand it correctly, I think this is just what
build_x_conditional_expr in ./cp/typeck.c does:
Different from CALL_EXPR, the TREE_TYPE of a COND_EXPR is determined
by the TREE_TYPEs of its latter two operands. When the types of the
two operands are different, a conversion is attempted on each operand
type to match the type of the other operand; while for a CALL_EXPR,
its TREE_TYPE is independent from the TREE_TYPE(s) of its arg(s).