This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [c++-concepts] requires expression semantics


On 07/04/2013 11:30 AM, Andrew Sutton wrote:
I ran through every test in the is_convertible unit test with
__is_convertible. There are 2 cases it doesn't address. The conversion
of a function type (int()) to its reference type (int(&)()),

I looked into this a bit more; it seemed odd to consider any conversion from int() since there are no prvalues of function type. The is_convertible trait is defined in terms of a conversion from an xvalue of the first type, so your __is_convertible_to trait should wrap type1 in an rvalue reference. That seems to give the correct result.

Looking at the other uses of can_convert, it seems like they mostly
don't deal with those cases. So, can_convert *might* be extended to
address these cases, but I'd rather be on the safe side and keep this
as a separate function.

I disagree. can_convert is not documented as only considering standard conversions, so it ought to handle user-defined conversions as well. My preference would be to rename the current function and any needed uses to can_convert_standard, and give the name can_convert the intuitive meaning.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]