Created on 2010-03-21.00:00:00 last changed 130 months ago
[Voted into the WP at the March, 2011 meeting as part of paper N3260.]
Proposed resolution (February, 2011):
This issue is resolved by the resolution of issue 1197.
According to 7.7 [expr.const] paragraph 3,
A constant expression is an integral constant expression if it is of integral or enumeration type. [Note: such expressions may be used as array bounds (9.3.4.5 [dcl.array], 7.6.2.8 [expr.new]), as case expressions (8.5.3 [stmt.switch]), as bit-field lengths (11.4.10 [class.bit]), as enumerator initializers (9.7.1 [dcl.enum]), and as integral or enumeration non-type template arguments (13.4 [temp.arg]). —end note]
Although there is conceptually a conversion from enumeration type to integral type involved in using an enumerator as an array bound or bit-field length, the normative wording for those uses does not explicitly mention it and simply requires an integral constant expression. Consequently, the current wording permits uses like the following:
enum class E { e = 10; }; struct S { int arr[E::e]; int i: E::e; };
This seems surprising.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: fdis -> c++11 |
2011-04-10 00:00:00 | admin | set | messages: + msg3314 |
2011-04-10 00:00:00 | admin | set | status: tentatively ready -> fdis |
2011-02-28 00:00:00 | admin | set | messages: + msg3225 |
2011-02-28 00:00:00 | admin | set | status: drafting -> tentatively ready |
2010-08-23 00:00:00 | admin | set | status: open -> drafting |
2010-03-21 00:00:00 | admin | create |