C++11 version of is_convertible does not need a check for is_abstract.
This commit is contained in:
jzmaddock
2014-04-27 16:51:19 +01:00
parent 14d6a21eb1
commit 03bff14498
2 changed files with 9 additions and 4 deletions

View File

@ -56,7 +56,9 @@ namespace detail {
#if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
// This is a C++11 conforming version:
// This is a C++11 conforming version, place this first and use it wherever possible:
# define BOOST_TT_CXX11_IS_CONVERTIBLE
template <class A, class B, class C>
struct or_helper
@ -416,7 +418,8 @@ struct is_convertible_impl_dispatch_base
typedef is_convertible_impl_select<
::boost::is_arithmetic<From>::value,
::boost::is_arithmetic<To>::value,
#ifndef BOOST_NO_IS_ABSTRACT
#if !defined(BOOST_NO_IS_ABSTRACT) && !defined(BOOST_TT_CXX11_IS_CONVERTIBLE)
// We need to filter out abstract types, only if we don't have a strictly conforming C++11 version:
::boost::is_abstract<To>::value
#else
false

View File

@ -56,7 +56,7 @@ struct bug_5271b
#endif
#if ((!defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)) || defined(BOOST_IS_CONVERTIBLE)) && !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
#if (defined(BOOST_TT_CXX11_IS_CONVERTIBLE) || defined(BOOST_IS_CONVERTIBLE)) && !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
struct bug9910
{
bug9910() = default;
@ -206,11 +206,13 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int, bug_5271a>::value), fal
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int, bug_5271b>::value), true);
#endif
#if ((!defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)) || defined(BOOST_IS_CONVERTIBLE)) && !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
#if (defined(BOOST_TT_CXX11_IS_CONVERTIBLE) || defined(BOOST_IS_CONVERTIBLE)) && !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
#ifndef _MSC_VER
// MSVC gives the wrong answer here, see https://connect.microsoft.com/VisualStudio/feedback/details/858956/std-is-convertible-returns-incorrect-value
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<Ref_bug9910, bug9910>::value), false);
#endif
// From https://svn.boost.org/trac/boost/ticket/9910#comment:2:
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int, incomplete_type[]>::value), false);
#endif
TT_TEST_END