This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.

457. bitset constructor: incorrect number of initialized bits

Section: 22.9.2.2 [bitset.cons] Status: CD1 Submitter: Dag Henriksson Opened: 2004-01-30 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [bitset.cons].

View all issues with CD1 status.

Discussion:

The constructor from unsigned long says it initializes "the first M bit positions to the corresponding bit values in val. M is the smaller of N and the value CHAR_BIT * sizeof(unsigned long)."

Object-representation vs. value-representation strikes again. CHAR_BIT * sizeof (unsigned long) does not give us the number of bits an unsigned long uses to hold the value. Thus, the first M bit position above is not guaranteed to have any corresponding bit values in val.

Proposed resolution:

In 22.9.2.2 [bitset.cons] paragraph 2, change "M is the smaller of N and the value CHAR_BIT * sizeof (unsigned long). (249)" to "M is the smaller of N and the number of bits in the value representation (section 6.8 [basic.types]) of unsigned long."