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

2024-12-06


628. The values of an enumeration with no enumerator

Section: 9.7.1  [dcl.enum]     Status: CD2     Submitter: Gennaro Prota     Date: 15 March 2007

N2800 comment UK 96

[Voted into the WP at the March, 2009 meeting.]

According to 9.7.1 [dcl.enum] paragraph 6, the underlying type of an enumeration with an empty enumeration-list is determined as if the enumeration-list contained a single enumerator with value 0. Paragraph 7, which specifies the values of an enumeration and the minimum size of bit-field needed represent those values needs a similar provision for empty enumeration-lists.

Proposed resolution (March, 2008):

Add the indicated sentence to the end of 9.7.1 [dcl.enum] paragraph 5:

...It is possible to define an enumeration that has values not defined by any of its enumerators. If the enumerator-list is empty, the values of the enumeration are as if the enumeration had a single enumerator with value 0.