diff --git a/numeric_traits_test.cpp b/numeric_traits_test.cpp index 9a32a3a..47ee09d 100644 --- a/numeric_traits_test.cpp +++ b/numeric_traits_test.cpp @@ -60,11 +60,19 @@ struct complement // indirection through complement_traits_aux necessary to keep MSVC happy typedef complement_traits_aux prev; public: +#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2 + // GCC 4.0.2 ICEs on these C-style casts + BOOST_STATIC_CONSTANT(Number, max = + Number((prev::max) << CHAR_BIT) + + Number(UCHAR_MAX)); + BOOST_STATIC_CONSTANT(Number, min = Number((prev::min) << CHAR_BIT)); +#else BOOST_STATIC_CONSTANT(Number, max = Number(Number(prev::max) << CHAR_BIT) + Number(UCHAR_MAX)); - BOOST_STATIC_CONSTANT(Number, min = Number(Number(prev::min) << CHAR_BIT)); +#endif + }; }; @@ -221,10 +229,16 @@ void test_aux(unsigned_tag, Number*) (sizeof(Number) < sizeof(boost::intmax_t)) | (boost::is_same::value)); +#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2 + // GCC 4.0.2 ICEs on this C-style cases + BOOST_STATIC_ASSERT((complement_traits::max) > Number(0)); + BOOST_STATIC_ASSERT((complement_traits::min) == Number(0)); +#else // Force casting to Number here to work around the fact that it's an enum on MSVC BOOST_STATIC_ASSERT(Number(complement_traits::max) > Number(0)); BOOST_STATIC_ASSERT(Number(complement_traits::min) == Number(0)); - +#endif + const Number max = complement_traits::max; const Number min = complement_traits::min; @@ -308,10 +322,15 @@ void test_aux(signed_tag, Number*) (sizeof(Number) < sizeof(boost::intmax_t)) | (boost::is_same::value)); +#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2 + // GCC 4.0.2 ICEs on this cast + BOOST_STATIC_ASSERT((complement_traits::max) > Number(0)); + BOOST_STATIC_ASSERT((complement_traits::min) < Number(0)); +#else // Force casting to Number here to work around the fact that it's an enum on MSVC BOOST_STATIC_ASSERT(Number(complement_traits::max) > Number(0)); BOOST_STATIC_ASSERT(Number(complement_traits::min) < Number(0)); - +#endif const Number max = complement_traits::max; const Number min = complement_traits::min;