[integer][type_traits] invaid values for integer_traits<boost::intmax_t>

Hi, the following has different behavior depending on whether <climits> in included in gcc-4.5 #include <climits> #include <boost/mpl/assert.hpp> #include <boost/mpl/bool.hpp> #include <boost/integer_traits.hpp> #include <boost/type_traits/integral_constant.hpp> #include <boost/cstdint.hpp> BOOST_MPL_ASSERT_MSG(false, BOOST_RATIO_OVERFLOW_IN_MUL, ( boost::integral_constant<boost::intmax_t,boost::integer_traits<boost::intmax_t>::const_min>, boost::integral_constant<boost::intmax_t,boost::integer_traits<boost::intmax_t>::const_max> )); With error: no matching function for call to 'assertion_failed(mpl_::failed************ (BOOST_RATIO_OVERFLOW_IN_MUL::************)(boost::integral_constant<long long int, -0x8000000000000000ll>, boost::integral_constant<long long int, 0x7fffffffffffffffll>))' and without error: no matching function for call to 'assertion_failed(mpl_::failed************ (BOOST_RATIO_OVERFLOW_IN_MUL::************)(boost::integral_constant<long long int, 128ll>, boost::integral_constant<long long int, -0x000000081ll>))' As you ca see the const_min and cont_max values are not correct in the last case. I was wondering if the <climits> file must be included by <boost/integer_traits.hpp> or <boost/cstdint.hpp>. Comments? Best, Vicente -- View this message in context: http://boost.2283326.n4.nabble.com/integer-type-traits-invaid-values-for-int... Sent from the Boost - Dev mailing list archive at Nabble.com.

AMDG On 2/12/2011 5:15 AM, Vicente Botet wrote:
<snip> BOOST_MPL_ASSERT_MSG(false, BOOST_RATIO_OVERFLOW_IN_MUL, (
boost::integral_constant<boost::intmax_t,boost::integer_traits<boost::intmax_t>::const_min>,
boost::integral_constant<boost::intmax_t,boost::integer_traits<boost::intmax_t>::const_max> ));
<snip>
error: no matching function for call to 'assertion_failed(mpl_::failed************ (BOOST_RATIO_OVERFLOW_IN_MUL::************)(boost::integral_constant<long long int, 128ll>, boost::integral_constant<long long int, -0x000000081ll>))'
As you can see the const_min and cont_max values are not correct in the last case.
I was wondering if the<climits> file must be included by <boost/integer_traits.hpp> or<boost/cstdint.hpp>. Comments?
It already #includes limits.h. This should be fixed in the trunk. (integer_traits was assuming that sizeof(long long) was the number of bits in a long long. I changed it to sizeof(long long) * CHAR_BIT) In Christ, Steven Watanabe

Steven Watanabe-4 wrote:
AMDG
On 2/12/2011 5:15 AM, Vicente Botet wrote:
<snip> BOOST_MPL_ASSERT_MSG(false, BOOST_RATIO_OVERFLOW_IN_MUL, (
boost::integral_constant<boost::intmax_t,boost::integer_traits<boost::intmax_t>::const_min>,
boost::integral_constant<boost::intmax_t,boost::integer_traits<boost::intmax_t>::const_max> ));
<snip>
error: no matching function for call to 'assertion_failed(mpl_::failed************ (BOOST_RATIO_OVERFLOW_IN_MUL::************)(boost::integral_constant<long long int, 128ll>, boost::integral_constant<long long int, -0x000000081ll>))'
As you can see the const_min and cont_max values are not correct in the last case.
I was wondering if the<climits> file must be included by <boost/integer_traits.hpp> or<boost/cstdint.hpp>. Comments?
It already #includes limits.h. This should be fixed in the trunk. (integer_traits was assuming that sizeof(long long) was the number of bits in a long long. I changed it to sizeof(long long) * CHAR_BIT)
I'm already using the trunk. Vicente -- View this message in context: http://boost.2283326.n4.nabble.com/integer-type-traits-invaid-values-for-int... Sent from the Boost - Dev mailing list archive at Nabble.com.

AMDG On 2/12/2011 7:36 AM, Vicente Botet wrote:
Steven Watanabe-4 wrote:
It already #includes limits.h. This should be fixed in the trunk. (integer_traits was assuming that sizeof(long long) was the number of bits in a long long. I changed it to sizeof(long long) * CHAR_BIT)
I'm already using the trunk.
I /just/ fixed it. In Christ, Steven Watanabe

Steven Watanabe-4 wrote:
AMDG
On 2/12/2011 7:36 AM, Vicente Botet wrote:
Steven Watanabe-4 wrote:
It already #includes limits.h. This should be fixed in the trunk. (integer_traits was assuming that sizeof(long long) was the number of bits in a long long. I changed it to sizeof(long long) * CHAR_BIT)
I'm already using the trunk.
I /just/ fixed it.
Thanks, It is OK now. Vicente -- View this message in context: http://boost.2283326.n4.nabble.com/integer-type-traits-invaid-values-for-int... Sent from the Boost - Dev mailing list archive at Nabble.com.
participants (2)
-
Steven Watanabe
-
Vicente Botet