Created on 2013-09-23.00:00:00 last changed 121 months ago
[Moved to DR at the February, 2014 meeting.]
Proposed resolution (September, 2013):
Change 9.7.1 [dcl.enum] paragraph 5 as follows:
...If the underlying type is fixed, the type of each
enumeratorenumerator prior to the closing brace is the underlying type and the constant-expression in the enumerator-definition shall be a converted constant expression of the underlying type (7.7 [expr.const]); if the initializing value of an enumerator cannot be represented by the underlying type, the program is ill-formed. If the underlying type is not fixed, the type of each enumerator prior to the closing brace isthe type of its initializing valuedetermined as follows:
If an initializer is specified for an enumerator,
the initializing valuethe constant-expression shall be an integral constant expression (7.7 [expr.const]). If the expression has unscoped enumeration type, the enumerator has the underlying type of that enumeration type, otherwise it has the same type as the expressionand the constant-expression shall be an integral constant expression (7.7 [expr.const]).If no initializer is specified for the first enumerator,
the initializing value hasits type is an unspecified integral type.Otherwise the type of the
initializing valueenumerator is the same asthe typethat ofthe initializing value ofthe preceding enumerator unless the incremented value is not representable in that type, in which case the type is an unspecified integral type sufficient to contain the incremented value. If no such type exists, the program is ill-formed.
Regarding the value of an enumerator whose enumeration's underlying type is not fixed, 9.7.1 [dcl.enum] paragraph 5 says,
the type of the initializing value is the same as the type of the initializing value of the preceding enumerator unless the incremented value is not representable in that type, in which case the type is an unspecified integral type sufficient to contain the incremented value.
It is not clear how this is to be applied when the preceding enumerator value is given by an enumerator whose value is the largest of its enumeration's values, and there is implementation variance on this point.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-11-24 00:00:00 | admin | set | status: dr -> c++14 |
2014-03-03 00:00:00 | admin | set | messages: + msg4948 |
2014-03-03 00:00:00 | admin | set | status: ready -> dr |
2013-10-14 00:00:00 | admin | set | messages: + msg4586 |
2013-09-23 00:00:00 | admin | create |