diff --git a/include/boost/type_traits/composite_traits.hpp b/include/boost/type_traits/composite_traits.hpp index 340c062..3f1f828 100644 --- a/include/boost/type_traits/composite_traits.hpp +++ b/include/boost/type_traits/composite_traits.hpp @@ -372,24 +372,48 @@ public: * is_enum * **********************************************/ -namespace detail{ -struct int_convertible +namespace detail { - int_convertible(int); -}; + struct int_convertible + { + int_convertible(int); + }; + + // Don't evaluate convertibility to int_convertible unless the type + // is non-arithmetic. This suppresses warnings with GCC. + template + struct is_enum_helper + { + template + struct type + { + BOOST_STATIC_CONSTANT(bool, value = false); + }; + }; + + template <> + struct is_enum_helper + { + template + struct type + : ::boost::is_convertible + { + }; + }; } // namespace detail #ifndef __BORLANDC__ template struct is_enum { private: typedef typename ::boost::add_reference::type r_type; -public: - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::type_traits::ice_not< ::boost::is_arithmetic::value>::value, - ::boost::type_traits::ice_not< ::boost::is_reference::value>::value, - ::boost::is_convertible::value + BOOST_STATIC_CONSTANT(bool, selector = + (::boost::type_traits::ice_or< + ::boost::is_arithmetic::value + , ::boost::is_reference::value >::value)); + typedef typename ::boost::detail::is_enum_helper::template type helper; +public: + BOOST_STATIC_CONSTANT(bool, value = helper::value); }; // Specializations suppress some nasty warnings with GCC