This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 110c. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2023-02-07


1660. member-declaration requirements and unnamed bit-fields

Section: 11.4  [class.mem]     Status: C++14     Submitter: Richard Smith     Date: 2013-04-15

[Moved to DR at the February, 2014 meeting.]

According to 11.4 [class.mem] paragraph 1,

Except when used to declare friends (11.8.4 [class.friend]) or to introduce the name of a member of a base class into a derived class (9.9 [namespace.udecl]), member-declarations declare members of the class, and each such member-declaration shall declare at least one member name of the class.

Unnamed bit-fields (11.4.10 [class.bit] paragraph 2) are described as not being members, and they obviously do not declare a member name; presumably they should therefore be included among the exceptions to this rule.

Additional note (October, 2013):

Curiously, the exemption for an unnamed bit-field not introducing names is in 9.1 [dcl.pre] paragraph 3, referring to a simple-declaration. However, a simple-declaration is not a member-declaration and thus does not apply.

Proposed resolution (November, 2013):

  1. Change 9.1 [dcl.pre] paragraph 3 as follows:

  2. ...In such cases, and except for the declaration of an unnamed bit-field (11.4.10 [class.bit]), the decl-specifier-seq shall introduce one or more names into the program, or shall redeclare a name introduced by a previous declaration. [Example:...
  3. Change 11.4 [class.mem] paragraph 1 as follows:

  4. ...Except when used to declare friends (11.8.4 [class.friend]), to declare an unamed bit-field (11.4.10 [class.bit]), or to introduce the name of a member of a base class into a derived class (9.9 [namespace.udecl]), member-declarations declare members of the class, and each such member-declaration shall declare at least one member name of the class. A member shall not...