
The recent changes to the type_traits library break our Boost.Python builds under IRIX, using the old MIPSpro 7.3.1 compiler. This compiler is based on EDG 238. The problem is illustrated by this simple piece of code: template <class T> struct is_signed_helper { static const bool value = (static_cast<T>(-1) < 0); }; % CC -n32 -mips4 -LANG:std -c foo.cpp cc-3314 CC: ERROR File = foo.cpp, Line = 4 The expression must have arithmetic, enum, or pointer type. static const bool value = (static_cast<T>(-1) < 0); ^ 1 error detected in the compilation of "foo.cpp". I tried several ideas for a workaround. The only one that worked in the end is the patch attached to this message. I know it is not pretty, but it has no effect on compilers other than EDG 238. I'd be happy to try other ideas, but all of Boost.Python compiles and runs with the patch. Unless someone else needs a more general fix (that works for user-defined types) I doubt the old compiler is worth more effort. Is the attached patch acceptable as a workaround? Cheers, Ralf Index: is_signed.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/type_traits/is_signed.hpp,v retrieving revision 1.1 diff -u -r1.1 is_signed.hpp --- is_signed.hpp 30 Jan 2005 15:47:45 -0000 1.1 +++ is_signed.hpp 2 Feb 2005 06:42:43 -0000 @@ -21,12 +21,35 @@ namespace detail{ +#if !(defined(__EDG_VERSION__) && __EDG_VERSION__ == 238) + template <class T> struct is_signed_helper { BOOST_STATIC_CONSTANT(bool, value = (static_cast<T>(-1) < 0)); }; +#else + +template <class T> +struct is_signed_helper; + +template <> struct is_signed_helper<char> { BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_signed_helper<signed char> { BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_signed_helper<unsigned char> { BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_signed_helper<short> { BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_signed_helper<unsigned short> { BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_signed_helper<int> { BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_signed_helper<unsigned int> { BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_signed_helper<long> { BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_signed_helper<unsigned long> { BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_signed_helper<long long> { BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_signed_helper<unsigned long long> { BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_signed_helper<float> { BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_signed_helper<double> { BOOST_STATIC_CONSTANT(bool, value = true); }; + +#endif + template <bool integral_type> struct is_signed_select_helper { Index: is_unsigned.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/type_traits/is_unsigned.hpp,v retrieving revision 1.1 diff -u -r1.1 is_unsigned.hpp --- is_unsigned.hpp 30 Jan 2005 15:47:45 -0000 1.1 +++ is_unsigned.hpp 2 Feb 2005 06:42:43 -0000 @@ -21,12 +21,35 @@ namespace detail{ +#if !(defined(__EDG_VERSION__) && __EDG_VERSION__ == 238) + template <class T> struct is_unsigned_helper { BOOST_STATIC_CONSTANT(bool, value = (static_cast<T>(-1) > 0)); }; +#else + +template <class T> +struct is_unsigned_helper; + +template <> struct is_unsigned_helper<char> { BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_unsigned_helper<signed char> { BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_unsigned_helper<unsigned char> { BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_unsigned_helper<short> { BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_unsigned_helper<unsigned short> { BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_unsigned_helper<int> { BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_unsigned_helper<unsigned int> { BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_unsigned_helper<long> { BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_unsigned_helper<unsigned long> { BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_unsigned_helper<long long> { BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_unsigned_helper<unsigned long long> { BOOST_STATIC_CONSTANT(bool, value = true); }; +template <> struct is_unsigned_helper<float> { BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_unsigned_helper<double> { BOOST_STATIC_CONSTANT(bool, value = false); }; + +#endif + template <bool integral_type> struct is_unsigned_select_helper { __________________________________ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com