This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
[Accepted as a DR at the June, 2023 meeting.]
6.8.2 [intro.object] clearly implies that bit-fieldsare objects; paragraphs 8-9 contain phrases like“unless an object is a bit-field...” and“a non-bit-field subobject”. However, thedefinition of “object representation” in6.9.1 [basic.types.general] paragraph 4 is,
Theobject representation of an object oftypeT is the sequence ofNunsignedchar objects taken up by the object of typeT,whereN equalssizeof(T).
and thus fails to address bit-fields, which are notnecessarily composed of a sequence of complete bytes.
The C Standard (6.2.6.1 paragraph 4) says,
Values stored in bit-fields consist ofm bits, wherem is the size specified for the bit-field. Theobject representation is the set ofm bits thebit-field comprises in the addressable storage unit holdingit.
Presumably similar wording could be adopted for C++.
Proposed resolution (approved by CWG 2023-01-06) [SUPERSEDED]:
Change in 6.9.1 [basic.types.general] paragraph 4 as follows:
Theobject representation ofan objectofa typeT is the sequence ofNunsigned char objects taken up bythea non-bit-field complete object of typeT, whereN equalssizeof(T). Thevaluerepresentation ofan object ofatypeT is the set of bitsin the object representationof T that participate in representing a value of typeT.The object and value representation of a non-bit-field completeobject of typeT are the bytes and bits, respectively, of theobject corresponding to the object and value representation of itstype. The object representation of a bit-field object is the sequenceofN bits taken up by the object, whereN is the widthof the bit-field (11.4.10 [class.bit]). The valuerepresentation of a bit-field object is the set of bits in the objectrepresentation that participate in representing its value. Bitsin the object representationof a type or object that arenot part of the value representation are padding bits. For triviallycopyable types, the value representation is a set of bits in theobject representation that determines a value, which is one discreteelement of an implementation-defined set of values. [ Footnote: ... ]
CWG 2023-02-06
Additional drafting is needed to constrain the definition tocomplete object types.
Proposed resolution (approved for C++26 by CWG 2023-02-06):
Change in 6.9.1 [basic.types.general] paragraph 4 as follows:
Theobject representation ofan objectofa complete object typeT is the sequence ofNunsigned char objects taken up bythea non-bit-field complete object of typeT, whereN equalssizeof(T). Thevaluerepresentation ofan object ofatypeT is the set of bitsin the object representationof T that participate in representing a value of typeT.The object and value representation of a non-bit-field completeobject of typeT are the bytes and bits, respectively, of theobject corresponding to the object and value representation of itstype. The object representation of a bit-field object is the sequenceofN bits taken up by the object, whereN is the widthof the bit-field (11.4.10 [class.bit]). The valuerepresentation of a bit-field object is the set of bits in the objectrepresentation that participate in representing its value. Bitsin the object representationof a type or object that arenot part of the value representation are padding bits. For triviallycopyable types, the value representation is a set of bits in theobject representation that determines a value, which is one discreteelement of an implementation-defined set of values. [ Footnote: ... ]