Created on 2009-04-01.00:00:00 last changed 178 months ago
[Voted into WP at October, 2009 meeting.]
Proposed resolution (July, 2009):
Change _N4567_.5.1.1 [expr.prim.general] paragraph 10 as follows:
...
if that id-expression denotes a non-static data member
and it is the sole constituent of appears in an
unevaluated operand, except for optional enclosing
parentheses. [Example:
struct S { int m; }; int i = sizeof(S::m); // OK int j = sizeof(S::m + 42); //error: reference to non-static member in subexpressionOK
—end example]
The resolution of issue 613, as reflected in the sixth bullet of _N4567_.5.1.1 [expr.prim.general] paragraph 10, allows an id-expression designating a non-static data member to be used
- if... it is the sole constituent of an unevaluated operand, except for optional enclosing parentheses.
The requirement that the id-expression be the “sole constituent” of the unevaluated operand seems unnecessarily strict, forbidding such plausible use cases as
struct S { int ar[42]; }; int i = sizeof(S::ar[0]);
or the use of the member as a function argument in template metaprogramming. The more general version of the restriction seems not to be very difficult to implement and may actually represent a simplification in some implementations.
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: + msg2432 |
2009-11-08 00:00:00 | admin | set | status: ready -> dr |
2009-08-03 00:00:00 | admin | set | messages: + msg2144 |
2009-08-03 00:00:00 | admin | set | status: open -> ready |
2009-04-01 00:00:00 | admin | create |