Hi,
On 05/22/2012 12:53 AM, Jason Merrill wrote:
On 05/21/2012 04:18 PM, Paolo Carlini wrote:
- check_narrowing (type, init);
+ check_narrowing (type, perform_implicit_conversion
+ (type, tinit, tf_none));
Any changes should go inside check_narrowing rather than outside. I
think the best fix if ftype is a class would be to find the implicit
conversion sequence from ftype to type, then drop the second standard
conversion sequence and just perform the user-defined conversion, then
continue with the rest of check_narrowing. The conversion part should
be a new function in call.c.
Let's see if I understand in detail the structure of the new function
(beyond all the simplifications possible because the target is a scalar,
etc): we want something quite similar to implicit_conversion, but at the
end of it, instead of using build_user_type_conversion_1 - which returns
a conversion and implies that the caller passes it to convert_like_real
- something like build_user_type_conversion (maybe exactly
build_user_type_conversion) Do I understand correctly?
Thanks,
Paolo.