Boost C++ Libraries: Ticket #2827: boost::detail::is_abstract_imp2::s1: 64 bit truncation warning https://svn.boost.org/trac10/ticket/2827 <p> The constant detail::is_abstract_imp2::s1 is declared as unsigned, but initialized to the result of sizeof(). sizeof() returns a 64 bit value when compiled on a 64 bit target. This causes a 64-to-32 bit truncation warning on 64 bit targets. </p> <p> One option would be to declare the constant to be of type size_t. I opted instead for a static_cast on the assumption that it would cause less disruption and that the sizeof() call in question would probably never return a value that required more than 32 bits. </p> <pre class="wiki">template&lt;class T&gt; struct is_abstract_imp2 { // Deduction fails if T is void, function type, // reference type (14.8.2/2)or an abstract class type // according to review status issue #337 // template&lt;class U&gt; static type_traits::no_type check_sig(U (*)[1]); template&lt;class U&gt; static type_traits::yes_type check_sig(...); // // T must be a complete type, further if T is a template then // it must be instantiated in order for us to get the right answer: // BOOST_STATIC_ASSERT(sizeof(T) != 0); // GCC2 won't even parse this template if we embed the computation // of s1 in the computation of value. #ifdef __GNUC__ BOOST_STATIC_CONSTANT(unsigned, s1 = static_cast&lt;unsigned&gt;(sizeof(is_abstract_imp2&lt;T&gt;::template check_sig&lt;T&gt;(0)))); #else #if BOOST_WORKAROUND(_MSC_FULL_VER, &gt;= 140050000) #pragma warning(push) #pragma warning(disable:6334) #endif BOOST_STATIC_CONSTANT(unsigned, s1 = static_cast&lt;unsigned&gt;(sizeof(check_sig&lt;T&gt;(0)))); #if BOOST_WORKAROUND(_MSC_FULL_VER, &gt;= 140050000) #pragma warning(pop) #endif #endif BOOST_STATIC_CONSTANT(bool, value = (s1 == sizeof(type_traits::yes_type))); }; </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2827 Trac 1.4.3 John Maddock Fri, 13 Mar 2009 17:55:23 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2827#comment:1 https://svn.boost.org/trac10/ticket/2827#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/51754" title="Add is_virtual_base_of. Add extra tests for is_base_of to test virtual ...">[51754]</a>) Add is_virtual_base_of. Add extra tests for is_base_of to test virtual inheritance. Trivial warning fix for is_abstract: fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2827" title="#2827: Bugs: boost::detail::is_abstract_imp2::s1: 64 bit truncation warning (closed: fixed)">#2827</a>. </p> Ticket