457. bitset constructor: incorrect number of initialized bits

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

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 23.9.2.1 [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.7 [basic.types]) of unsigned long."