------- Comment #16 from aoliva at gcc dot gnu dot org 2008-02-05 03:35 ------- Jakub, build_identity_conv is correct, at least in this case. In C++, the bitfieldness :-) of a variable is not to be taken into account for purposes of overload resolution. So, when tfrom != from, this means it is an identity conversion, but one that C++ represents internally using the variant bitfield type, which leads to this sort of problem.
I'm a bit concerned about adding the type conversion to build_target_expr(), because of the comment above force_target_expr(): /* Like the above function, but without the checking. This function should only be used by code which is deliberately trying to subvert the type system, such as call_builtin_trap. */ Forcing a conversion might break the deliberate expectations mentioned there, although I can't see that such expectations are still present in the current code. There are only two callers of force_target_expr(), and I don't see that either has anything to do with subverting the type system. Anyhow, I think it might be more appropriate to add the type conversion to build_target_expr_with_type(), which most of C++ uses anyway, and where the desired type is explicitly specified. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35056