------- Comment #17 from mmitchel at gcc dot gnu dot org 2008-02-05 05:22
-------
I would suggest inserting the conversion right before the call to
build_target_expr_with_type in convert_like_real:
if ((lvalue & clk_packed)
&& CLASS_TYPE_P (type)
&& !TYPE_HAS_TRIVIAL_INIT_REF (type))
{
error ("cannot bind packed field %qE to %qT",
expr, ref_type);
return error_mark_node;
}
expr = build_target_expr_with_type (expr, type);
In particular, call:
/* If EXPR is a bitfield, convert it to its declared type before
building a TARGET_EXPR. */
expr = convert_bitfield_to_declared_type (expr);
You could do this somewhere in build_target_expr, but I think it's better to
leave those routines as low-level details.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35056