> This seems to assume that there is a result-type-requirement. > >> +// Returns true if type1 can be implicitly converted to type2. >> +static inline bool >> +convertible_to_p (tree type1, tree type2) >> +{ >> + // Build a "fake" conversion expression to force the lookup of user >> + // defined conversion sequences. >> + tree expr = build_min (CAST_EXPR, type1); >> + return can_convert_arg (type2, type1, expr, LOOKUP_IMPLICIT, tf_none); >> +} > > > Can't you use can_convert instead of a new function?
I couldn't use can_convert at the time I first wrote this. I seem to remember that function requiring an extra expression to search for user-defined conversions. Hence the weird empty CAST_EXPR. If that's no longer the case, then yes. I'll look (but probably not until Tuesday). Andrew