From b0620a46ff986e78221a386504fe966e24f7d60b Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 23 Sep 2011 20:27:22 +0000 Subject: [PATCH] Unordered: Don't use `BOOST_UNORDERED_HAS_FUNCTION` with Sun. Something is causing the sun compiler to crash. I don't know if it's the member detection or testing if the member if callable, so try disabling the callable test to see if that works better. [SVN r74541] --- .../unordered/detail/allocator_helpers.hpp | 69 ++++++++++++------- 1 file changed, 45 insertions(+), 24 deletions(-) diff --git a/include/boost/unordered/detail/allocator_helpers.hpp b/include/boost/unordered/detail/allocator_helpers.hpp index 5dc8491e..6982140f 100644 --- a/include/boost/unordered/detail/allocator_helpers.hpp +++ b/include/boost/unordered/detail/allocator_helpers.hpp @@ -178,6 +178,9 @@ namespace boost { namespace unordered { namespace detail { #if !defined(BOOST_NO_SFINAE_EXPR) || BOOST_WORKAROUND(BOOST_MSVC, >= 1500) +# define BOOST_UNORDERED_HAVE_CALL_0_DETECTION 1 +# define BOOST_UNORDERED_HAVE_CALL_N_DETECTION 1 + template struct expr_test; template struct expr_test : T {}; template static char for_expr_test(U const&); @@ -203,30 +206,12 @@ namespace boost { namespace unordered { namespace detail { enum { value = sizeof(test(choose())) == sizeof(choice1::type) };\ } - template - BOOST_UNORDERED_HAS_FUNCTION( - select_on_container_copy_construction, U const, (), 0 - ); - - // Only supporting the basic copy constructor for now. - - template - BOOST_UNORDERED_HAS_FUNCTION( - construct, U, (make(), make()), 2 - ); - - template - BOOST_UNORDERED_HAS_FUNCTION( - destroy, U, (make()), 1 - ); - - template - BOOST_UNORDERED_HAS_FUNCTION( - max_size, U const, (), 0 - ); - #else +# define BOOST_UNORDERED_HAVE_CALL_0_DETECTION 0 +# define BOOST_UNORDERED_HAVE_CALL_N_DETECTION \ + !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100)) + template struct identity { typedef T type; }; #define BOOST_UNORDERED_CHECK_MEMBER(count, result, name, member) \ @@ -298,9 +283,27 @@ namespace boost { namespace unordered { namespace detail { }; \ } +#endif + +#if BOOST_UNORDERED_HAVE_CALL_0_DETECTION + template + BOOST_UNORDERED_HAS_FUNCTION( + select_on_container_copy_construction, U const, (), 0 + ); + + template + BOOST_UNORDERED_HAS_FUNCTION( + max_size, U const, (), 0 + ); +#else template BOOST_UNORDERED_HAS_MEMBER(select_on_container_copy_construction); + template + BOOST_UNORDERED_HAS_MEMBER(max_size); +#endif + +#if BOOST_UNORDERED_HAVE_CALL_N_DETECTION template BOOST_UNORDERED_HAS_FUNCTION( construct, U, (make(), make()), 2 @@ -310,10 +313,12 @@ namespace boost { namespace unordered { namespace detail { BOOST_UNORDERED_HAS_FUNCTION( destroy, U, (make()), 1 ); +#else + template + BOOST_UNORDERED_HAS_MEMBER(construct); template - BOOST_UNORDERED_HAS_MEMBER(max_size); - + BOOST_UNORDERED_HAS_MEMBER(destroy); #endif template @@ -513,4 +518,20 @@ namespace boost { namespace unordered { namespace detail { }; }}} +#undef BOOST_UNORDERED_DEFAULT_TYPE_TMPLT +#undef BOOST_UNORDERED_DEFAULT_TYPE +#undef BOOST_UNORDERED_HAVE_CALL_0_DETECTION +#undef BOOST_UNORDERED_HAVE_CALL_N_DETECTION +#undef BOOST_UNORDERED_HAS_FUNCTION +#if defined(BOOST_UNORDERED_CHECK_EXPRESSION) +# undef BOOST_UNORDERED_CHECK_EXPRESSION +# undef BOOST_UNORDERED_DEFAULT_EXPRESSION +#endif +#if defined(BOOST_UNORDERED_HAS_MEMBER) +# undef BOOST_UNORDERED_HAS_MEMBER +# undef BOOST_UNORDERED_CHECK_MEMBER +# undef BOOST_UNORDERED_DEFAULT_MEMBER +# undef BOOST_UNORDERED_WRAP_PARAMATERS +#endif + #endif