Created on1997-11-23.00:00:00 last changed277 months ago
Proposed Resolution (04/99):Change the first sentence of 6.3 [basic.def.odr]paragraph 2 from:
An expression ispotentially evaluated unless eitherit is the operand of thesizeof operator (7.6.2.5 [expr.sizeof]), or it is theoperand of thetypeid operator and does not designate an lvalueof polymorphic class type (7.6.1.8 [expr.typeid]).to:
An expression ispotentially evaluated unlessitappears where anintegral constant expression is required (see 7.7 [expr.const]),isthe operand of thesizeof operator (7.6.2.5 [expr.sizeof]), oris the operand of thetypeid operator and the expression doesnot designate an lvalue of polymorphic class type (7.6.1.8 [expr.typeid]).
Also see section: 6.3 [basic.def.odr].
Originally, all static data members still had to be defined outside theclass whether they were used or not.
But that restriction was supposed to be lifted so that staticdata members need not be defined outside the class unless they are usedin a manner which requires their definition,in the same manner as namespace-scopevariables. In particular, if an integral/enum const static data memberis initialized within the class, and its address is never taken, we agreedthat no namespace-scope definition was required.
For example:
struct A { static const int size = 10; int array[size]; }; int main() { A a; return 0; }However, 11.4.9.3 [class.static.data] paragraph 4says:The member shall still be defined in a namespace scope if itis used in the program and the namespace scope definition shall not containan initializer.A narrow interpreration of "used" in this rule would make the example ill-formedbecause there is no namespace-scope definition of "size".A better wording for this rule would be:
The member shall still be defined in a namespace scope if itis used in the program in the manner described in 6.3 [basic.def.odr].The namespace scope definition shall not contain an initializer.Also, the wording in 6.3 [basic.def.odr] paragraph 2:
An expression is potentially evaluated unless either it isthe operand of thesizeof operator (7.6.2.5 [expr.sizeof]), or it is the operandof thetypeid operator and does not designate an lvalue of polymorphicclass type (7.6.1.8 [expr.typeid]).is incomplete because it does not mention the use of a compile-time constantas an array bound or template argument. It should say something like:
An expression is potentially evaluated unless it is the operandof the sizeof operator (7.6.2.5 [expr.sizeof]), the operand of the typeid operator,anintegral constant-expression used as an array bound or anintegral constant-expression used as atemplate-argumentfor a non-referencetemplate-parameter; and the expressiondoes not designate an lvalue of polymorphic class type (7.6.1.8 [expr.typeid]).
Proposed Resolution (04/99):Change the first sentence of 6.3 [basic.def.odr]paragraph 2 from:
An expression ispotentially evaluated unless eitherit is the operand of thesizeof operator (7.6.2.5 [expr.sizeof]), or it is theoperand of thetypeid operator and does not designate an lvalueof polymorphic class type (7.6.1.8 [expr.typeid]).to:
An expression ispotentially evaluated unlessitappears where anintegral constant expression is required (see 7.7 [expr.const]),isthe operand of thesizeof operator (7.6.2.5 [expr.sizeof]), oris the operand of thetypeid operator and the expression doesnot designate an lvalue of polymorphic class type (7.6.1.8 [expr.typeid]).
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2003-04-25 00:00:00 | admin | set | status: dr -> tc1 |
| 1999-09-14 00:00:00 | admin | set | messages: +msg207 |
| 1999-09-14 00:00:00 | admin | set | status: drafting -> dr |
| 1997-11-23 00:00:00 | admin | create | |