Subject: [Boost-bugs] [Boost C++ Libraries] #9014: Warnings when compiling api_test_helpers.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-08-19 10:52:39
#9014: Warnings when compiling api_test_helpers.hpp
----------------------------------+--------------------------
Reporter: gjasny@⦠| Owner: timblechmann
Type: Bugs | Status: new
Milestone: To Be Determined | Component: atomic
Version: Boost Release Branch | Severity: Cosmetic
Keywords: |
----------------------------------+--------------------------
Hello,
clang 3.3 warns about about the truncation of the larger constant:
{{{
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<T>(((T)-1) << (sizeof(T) * 8 - 1));
~~~~~~~~~~~~~~~~~~ ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
native_api.cpp:20:5: note: in instantiation of function template
specialization 'test_integral_api<unsigned char>' requested here
test_integral_api<unsigned char>();
^
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<T>(~ (((T)-1) << (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<T>(((T)-1) << (sizeof(T) * 8 - 1));
~~~~~~~~~~~~~~~~~~ ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
native_api.cpp:24:5: note: in instantiation of function template
specialization 'test_integral_api<unsigned short>' requested here
test_integral_api<unsigned short>();
^
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<T>(~ (((T)-1) << (sizeof(T) * 8 - 1)));
~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
}}}
Thanks,
Gregor
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9014> 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:50:13 UTC