Modify

Opened 3 years ago

Last modified 9 months ago

#11390 new Bugs

Wrong type in dynamic_bitset::reference constructor

Reported by: stefan.atev@… Owned by: jsiek
Milestone: To Be Determined Component: dynamic_bitset
Version: Boost 1.58.0 Severity: Problem
Keywords: Cc:

Description

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.

Attachments (0)

Change History (2)

comment:1 Changed 10 months ago by anonymous

Does anyone maintain this library?

comment:2 Changed 9 months ago by stefan.atev@…

Apparently it is not maintained, I reported this against 1.58, and it's still in 1.62; I just trained myself to use .set() and .test()

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain jsiek.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.