Created on 2008-09-22.00:00:00 last changed 178 months ago
[Voted into WP at October, 2009 meeting.]
Proposed resolution (July, 2009):
Change 7.7 [expr.const] paragraph 2, bullet 4, sub-bullet 1 as follows:
Additional note, June, 2009:
It has been suggested that the requirement that a static data member be initialized in the class definition is not actually needed but that static data members should be treated like other variable declarations -- a preceding definition with initialization should be sufficient. That is, given
extern const int i; const int i = 5; struct S { static const int j; }; const int S::j = 5; int a1[i]; int a2[S::j];
there doesn't appear to be a good rationale for making a1 well-formed and a2 ill-formed. Some major implementations accept the declaration of a2 without error.
Proposed resolution (March, 2009):
Change 7.7 [expr.const] paragraph 2, bullet 4, sub-bullet 1 as follows:
an lvalue of effective integral type that refers to a non-volatile const variable with a preceding initialization or to a non-volatile const static data member with an initialization in the class definition (11.4.9.3 [class.static.data]), in either case initialized with constant expressions, or
7.7 [expr.const] paragraph 2 allows an lvalue-to-rvalue conversion in a constant expression if it is applied to “an lvalue of effective integral type that refers to a non-volatile const variable or static data member initialized with constant expressions.” However, this does not require, as it presumably should, that the initialization occur in the same translation unit and precede the constant expression, nor that the static data member be initialized within the member-specification of its class.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-03-29 00:00:00 | admin | set | status: dr -> cd2 |
2009-11-08 00:00:00 | admin | set | messages: + msg2445 |
2009-11-08 00:00:00 | admin | set | status: ready -> dr |
2009-08-03 00:00:00 | admin | set | messages: + msg2155 |
2009-08-03 00:00:00 | admin | set | status: review -> ready |
2009-06-19 00:00:00 | admin | set | messages: + msg2039 |
2009-03-23 00:00:00 | admin | set | messages: + msg1930 |
2009-03-23 00:00:00 | admin | set | status: open -> review |
2008-09-22 00:00:00 | admin | create |