diff --git a/include/boost/mpl/aux_/has_xxx.hpp b/include/boost/mpl/aux_/has_xxx.hpp index 08b259b..00131ec 100644 --- a/include/boost/mpl/aux_/has_xxx.hpp +++ b/include/boost/mpl/aux_/has_xxx.hpp @@ -33,23 +33,25 @@ # define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \ template< typename T > \ -boost::mpl::aux::yes_tag \ -trait##_helper( \ - boost::mpl::aux::type_wrapper const volatile* \ - , boost::mpl::aux::type_wrapper* = 0 \ - ); \ - \ -boost::mpl::aux::no_tag \ -trait##_helper(...); \ - \ -template< typename T > \ struct trait \ { \ + template< typename U > \ + static boost::mpl::aux::yes_tag \ + helper( \ + boost::mpl::aux::type_wrapper const volatile* \ + , boost::mpl::aux::type_wrapper* = 0 \ + ); \ + \ + static boost::mpl::aux::no_tag \ + helper(...); \ + \ typedef boost::mpl::aux::type_wrapper t_; \ - BOOST_STATIC_CONSTANT(bool, value = \ - sizeof((trait##_helper)(static_cast(0))) \ - == sizeof(boost::mpl::aux::yes_tag) \ - ); \ + \ + BOOST_STATIC_CONSTANT( \ + bool, value = \ + sizeof(trait::helper(static_cast(0))) \ + == sizeof(boost::mpl::aux::yes_tag) \ + ); \ }; \ /**/ diff --git a/test/aux_/has_xxx.cpp b/test/aux_/has_xxx.cpp index 9e33273..8178405 100644 --- a/test/aux_/has_xxx.cpp +++ b/test/aux_/has_xxx.cpp @@ -35,6 +35,8 @@ struct b5 { typedef int xxx[10]; }; struct b6 { typedef void (*xxx)(); }; struct b7 { typedef void (xxx)(); }; +template struct outer; +template struct inner { typedef typename T::type type; }; int main() { @@ -59,5 +61,7 @@ int main() BOOST_STATIC_ASSERT(has_xxx::value); BOOST_STATIC_ASSERT(has_xxx::value); + BOOST_STATIC_ASSERT(!has_xxx > >::value); + return 0; }