Subject: [Boost-bugs] [Boost C++ Libraries] #10818: A C4267 "possible loss of data" warning when compiling on VS2013 x64 with /W4
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-11-26 06:14:30
#10818: A C4267 "possible loss of data" warning when compiling on VS2013 x64 with
/W4
------------------------------+----------------------------
Reporter: kaa123@⦠| Owner: jsiek
Type: Bugs | Status: new
Milestone: To Be Determined | Component: dynamic_bitset
Version: Boost 1.56.0 | Severity: Cosmetic
Keywords: |
------------------------------+----------------------------
Example:
boost::dynamic_bitset<> flags;
...
bool b = flags[56];
Warning when calling the reference class constructor from the [] operator.
Compiler -- VS2013, Platform -- x64, Debug mode, Warning level -- /W4.
Fix: I found if you changed the pos parameter of the reference class
constructor to size_type, the warning went away.
From:
reference(block_type & b, block_type pos)
To:
reference(block_type & b, size_type pos)
Location Line 88 of dynamic_bitset.hpp
Actual error message:
4>C:\Boost\1_56_0-VS_2013-x64\include\boost-
1_56\boost/dynamic_bitset/dynamic_bitset.hpp(296): warning C4267:
'argument' : conversion from 'size_t' to 'unsigned long', possible loss of
data
4> C:\Boost\1_56_0-VS_2013-x64\include\boost-
1_56\boost/dynamic_bitset/dynamic_bitset.hpp(295) : while compiling class
template member function 'boost::dynamic_bitset<unsigned
long,std::allocator<Block>>::reference
boost::dynamic_bitset<Block,std::allocator<Block>>::operator
[](boost::dynamic_bitset<Block,std::allocator<Block>>::size_type)'
reference(block_type & b, size_type pos)
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10818> 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:17 UTC