Modify

Opened 9 years ago

Last modified 7 years ago

#2826 new Bugs

constant boost::mpl::aux::template_arity_impl::value causes 64 bit truncation warning

Reported by: pelee@… Owned by: Joel Falcou
Milestone: Boost 1.47.0 Component: mpl
Version: Boost Release Branch Severity: Problem
Keywords: Cc: joel.falcou@…

Description

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)
        );
};

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by Joel Falcou

Cc: joel.falcou@… added
Milestone: Boost 1.39.0Boost 1.47.0
Owner: changed from Aleksey Gurtovoy to Joel Falcou

I suspect this bug will be fixed by https://svn.boost.org/trac/boost/ticket/2297 Once I applied this one, I'll take care of resting this. Do you have small repro I can use to cross check this issue ?

Thanks in advance.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Joel Falcou.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.