diff --git a/include/boost/type_traits/is_polymorphic.hpp b/include/boost/type_traits/is_polymorphic.hpp index ee73711..ea0aeb8 100644 --- a/include/boost/type_traits/is_polymorphic.hpp +++ b/include/boost/type_traits/is_polymorphic.hpp @@ -7,6 +7,7 @@ #define BOOST_TT_IS_POLYMORPHIC_HPP #include +#include // should be the last #include #include "boost/type_traits/detail/bool_trait_def.hpp" @@ -16,13 +17,14 @@ namespace detail{ template struct is_polymorphic_imp1 { - struct d1 : public T + typedef remove_cv::type ncvT; + struct d1 : public ncvT { d1(); ~d1()throw(); char padding[256]; }; - struct d2 : public T + struct d2 : public ncvT { d2(); virtual ~d2()throw(); diff --git a/test/tricky_partial_specialization_test.cpp b/test/tricky_partial_specialization_test.cpp index fd48351..746f173 100644 --- a/test/tricky_partial_specialization_test.cpp +++ b/test/tricky_partial_specialization_test.cpp @@ -13,6 +13,7 @@ #include TYPE_TRAITS(is_base_and_derived) #include TYPE_COMPARE(is_same) #include TYPE_COMPARE(is_convertible) +#include TYPE_TRAITS(is_polymorphic) // // VC++ emits an awful lot of warnings unless we define these: @@ -59,6 +60,18 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_same::value) BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, false); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); + TT_TEST_END