Boost logo

Boost :

Subject: [boost] [integer][type_traits] invaid values for integer_traits<boost::intmax_t>
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-02-12 08:15:59


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-integer-traits-boost-intmax-t-tp3302672p3302672.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk