[Boost-bugs] [Boost C++ Libraries] #2826: constant boost::mpl::aux::template_arity_impl::value causes 64 bit truncation warning

Subject: [Boost-bugs] [Boost C++ Libraries] #2826: constant boost::mpl::aux::template_arity_impl::value causes 64 bit truncation warning
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-03-03 22:29:56


#2826: constant boost::mpl::aux::template_arity_impl::value causes 64 bit
truncation warning
----------------------------------+-----------------------------------------
 Reporter: pelee_at_[hidden] | Owner: agurtovoy
     Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: mpl
  Version: Boost Release Branch | Severity: Problem
 Keywords: |
----------------------------------+-----------------------------------------
 When compiled for a 64 bit target, the constant
 boost::mpl::aux::template_arity_impl::value causes a warning about
 possible truncation of a 64 bit value to 32 bits. This is because size_t
 (returned by sizeof()) is 64 bits, while value is declared as an int. One
 fix would be to declare the constant as a size_t. Instead I added a
 static_cast on the assumption that it would be less disruptive and the
 value returned by sizeof() was unlikely to require more than 32 bits.


 {{{
 typename arity_tag<6>::type
 arity_helper(type_wrapper< F< T1,T2,T3,T4,T5,T6 > >, arity_tag<6>);
 template< typename F, int N >
 struct template_arity_impl
 {
     BOOST_STATIC_CONSTANT(int, value =
           static_cast<int>(sizeof(arity_helper(type_wrapper<F>(),
 arity_tag<N>())) - 1)
         );
 };

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2826>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC