Boost C++ Libraries: Ticket #9014: Warnings when compiling api_test_helpers.hpp https://svn.boost.org/trac10/ticket/9014 <p> Hello, </p> <p> clang 3.3 warns about about the truncation of the larger constant: </p> <pre class="wiki">clang-linux.compile.c++.without-pth ../../../bin.v2/libs/atomic/test/native_api.test/clang-linux-3.3/debug/threading-multi/native_api.o In file included from native_api.cpp:12: ./api_test_helpers.hpp:268:35: warning: implicit conversion from 'int' to 'unsigned char' changes value from 32640 to 128 [-Wconstant-conversion] test_additive_wrap&lt;T&gt;(((T)-1) &lt;&lt; (sizeof(T) * 8 - 1)); ~~~~~~~~~~~~~~~~~~ ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ native_api.cpp:20:5: note: in instantiation of function template specialization 'test_integral_api&lt;unsigned char&gt;' requested here test_integral_api&lt;unsigned char&gt;(); ^ In file included from native_api.cpp:12: ./api_test_helpers.hpp:269:27: warning: implicit conversion from 'int' to 'unsigned char' changes value from -32641 to 127 [-Wconstant-conversion] test_additive_wrap&lt;T&gt;(~ (((T)-1) &lt;&lt; (sizeof(T) * 8 - 1))); ~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./api_test_helpers.hpp:268:35: warning: implicit conversion from 'int' to 'unsigned short' changes value from 2147450880 to 32768 [-Wconstant-conversion] test_additive_wrap&lt;T&gt;(((T)-1) &lt;&lt; (sizeof(T) * 8 - 1)); ~~~~~~~~~~~~~~~~~~ ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ native_api.cpp:24:5: note: in instantiation of function template specialization 'test_integral_api&lt;unsigned short&gt;' requested here test_integral_api&lt;unsigned short&gt;(); ^ In file included from native_api.cpp:12: ./api_test_helpers.hpp:269:27: warning: implicit conversion from 'int' to 'unsigned short' changes value from -2147450881 to 32767 [-Wconstant-conversion] test_additive_wrap&lt;T&gt;(~ (((T)-1) &lt;&lt; (sizeof(T) * 8 - 1))); ~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 warnings generated. </pre><p> Thanks, Gregor </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9014 Trac 1.4.3 Andrey Semashev Mon, 17 Aug 2015 19:30:55 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/9014#comment:1 https://svn.boost.org/trac10/ticket/9014#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> Should be fixed in <a class="ext-link" href="https://github.com/boostorg/atomic/commit/b1bb36c5b338ad6c259f1a252ee885733d626471"><span class="icon">​</span>https://github.com/boostorg/atomic/commit/b1bb36c5b338ad6c259f1a252ee885733d626471</a>. </p> Ticket