[Boost-bugs] [Boost C++ Libraries] #11390: Wrong type in dynamic_bitset::reference constructor

Subject: [Boost-bugs] [Boost C++ Libraries] #11390: Wrong type in dynamic_bitset::reference constructor
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-06-10 16:42:24


#11390: Wrong type in dynamic_bitset::reference constructor
------------------------------+----------------------------
 Reporter: stefan.atev@… | Owner: jsiek
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: dynamic_bitset
  Version: Boost 1.58.0 | Severity: Problem
 Keywords: |
------------------------------+----------------------------
 When compiling with visual studio 2013, the following warning is issued
 (and since we treat these as errors, fails the compilation):

 boost/dynamic_bitset/dynamic_bitset.hpp(298): warning C4267: 'argument' :
 conversion from 'size_t' to 'unsigned long', possible loss of data

 The culprit is the reference constructor:

 reference(block_type & b, block_type pos)

 which should be:

 reference(block_type & b, block_width_type pos)

 used in the non-const accessor:

 reference operator[](size_type pos) {
         return reference(m_bits[block_index(pos)], bit_index(pos));
     }

 bit_index() is defined as returning block_width_type, not block_type
 (which may be narrower).

 The const accessor works as expected and is a possible workaround when
 read-only access is required from a non-const bitset.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11390>
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:18 UTC