|
Boost : |
Subject: Re: [boost] [type_traits][parameter] Inconsistent boost::is_convertible between gcc and clang
From: John Maddock (boost.regex_at_[hidden])
Date: 2012-08-18 03:41:09
>> The following code works well (incl. your mentioned cases)
>> both in C++03 and C++11 on gcc.
> <snip>
>> static bool const rval_to_nonconst_lval_ref_conv =
>> ::boost::type_traits::ice_and<
>> !(::boost::is_function<From>::value) // Note: an rvalue ref to
>> function type is an lvalue
>> , !(::boost::is_reference<From>::value)
>> , ::boost::is_reference<To>::value
>> , !(::boost::is_const<typename
>> ::boost::remove_reference<To>::type>::value)
>> >::value;
>
> Sorry, the above code is wrong. It does not detect binding
> const volatile reference to an rvalue.
> Here is a right code:
>
> static bool const rval_to_nonconst_lval_ref_conv =
> ::boost::type_traits::ice_and<
> !(::boost::is_function<From>::value) // Note: an rvalue ref to
> function type is an lvalue
> , !(::boost::is_reference<From>::value)
> , ::boost::is_reference<To>::value
> , ::boost::type_traits::ice_or<
> !::boost::is_const<typename
> ::boost::remove_reference<To>::type>::value
> , ::boost::type_traits::ice_and<
> ::boost::is_const<typename
> ::boost::remove_reference<To>::type>::value
> , ::boost::is_volatile<typename
> ::boost::remove_reference<To>::type>::value
> >::value
> >::value
> >::value;
Michel,
Apologies for the delay, as I have no time right now, can you please let me
have this as a patch, and verify our test suite passes? Any changes should
also probably be dependent upon BOOST_NO_SFINAE_EXPR as well as I believe
the technique depends upon that.
Sorry for the abundance of caution, but something somewhere usually breaks
when we mess with a header like that, and there's a limit to how many folks
I'm willing to annoy to fix a corner case! ;-)
Cheers, John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk