diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 0017bcc..eae359d 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -112,8 +112,6 @@ # define BOOST_IS_CLASS(T) __is_class(T) # define BOOST_IS_CONVERTIBLE(T,U) ((__is_convertible_to(T,U) || (is_same::value && !is_function::value)) && !__is_abstract(U)) # define BOOST_IS_ENUM(T) __is_enum(T) -// This one doesn't quite always do the right thing: -// # define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) // This one fails if the default alignment has been changed with /Zp: // # define BOOST_ALIGNMENT_OF(T) __alignof(T) @@ -121,6 +119,11 @@ # define BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) ((__has_trivial_move_constructor(T) || boost::is_pod::value) && ! ::boost::is_volatile::value && ! ::boost::is_reference::value) # define BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T) ((__has_trivial_move_assign(T) || boost::is_pod::value) && ! ::boost::is_const::value && !::boost::is_volatile::value && ! ::boost::is_reference::value) # endif +#ifndef BOOST_NO_CXX11_FINAL +// This one doesn't quite always do the right thing on older VC++ versions +// we really need it when the final keyword is supporyted though: +# define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) +#endif #if _MSC_FULL_VER >= 180020827 # define BOOST_IS_NOTHROW_MOVE_ASSIGN(T) (__is_nothrow_assignable(T&, T&&)) # define BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T) (__is_nothrow_constructible(T, T&&)) diff --git a/test/is_polymorphic_test.cpp b/test/is_polymorphic_test.cpp index 7426be8..b200b5a 100644 --- a/test/is_polymorphic_test.cpp +++ b/test/is_polymorphic_test.cpp @@ -82,6 +82,11 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); // this test was added to check for bug reported on 21 May 2003: BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); +#ifndef BOOST_NO_CXX11_FINAL +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic < final_UDT >::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); +#endif + TT_TEST_END diff --git a/test/test.hpp b/test/test.hpp index ae3d24e..6514dab 100644 --- a/test/test.hpp +++ b/test/test.hpp @@ -265,11 +265,6 @@ struct nothrow_construct_UDT { return true; } }; -#ifndef BOOST_NO_CXX11_FINAL -struct final_UDT final -{}; -#endif - class Base { }; class Derived : public Base { }; @@ -370,6 +365,14 @@ struct polymorphic_derived2 : public polymorphic_base virtual void method(); }; +#ifndef BOOST_NO_CXX11_FINAL +struct final_UDT final +{}; +struct polymorphic_derived_final final : public polymorphic_derived2 +{}; +#endif + + struct virtual_inherit1 : public virtual Base { }; struct virtual_inherit2 : public virtual_inherit1 { }; struct virtual_inherit3 : private virtual Base {};