CWG Issue 850 (original) (raw)

This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-11-05


850. Restrictions on use of non-static data members

Section: _N4567_.5.1.1 [expr.prim.general]Status: CD2Submitter: Jason MerrillDate: 1 April, 2009

[Voted into WP at October, 2009 meeting.]

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

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.

Proposed resolution (July, 2009):

Change _N4567_.5.1.1 [expr.prim.general] paragraph 10 as follows: