Full name of submitter: Vincent X
Reference: [expr.prim.id.general]
Issue description: P1787R6 effectively relaxed the constraints on the transformation of id-expressions (to non-static non-type members) in class scope into class member access expressions, such that they may be transformed even if the expression this is not allowed in the context. Consider:
struct A {
int x;
int a[sizeof(x)]; // (1)
decltype(x) f(); // (2)
};
Under the current rules of [expr.prim.id.general]/2, both expressions of x in (1) and (2) are transformed into (*this).x, making the declarations ill-formed. This is because P1787R6 removed the old constraint (as referenced in #[class.mfct.non-static]):
[...] in a context where this can be used [...]
Suggested resolution: Reintroduce the constraint where appropriate.
Full name of submitter: Vincent X
Reference: [expr.prim.id.general]
Issue description: P1787R6 effectively relaxed the constraints on the transformation of id-expressions (to non-static non-type members) in class scope into class member access expressions, such that they may be transformed even if the expression
thisis not allowed in the context. Consider:Under the current rules of [expr.prim.id.general]/2, both expressions of
xin (1) and (2) are transformed into(*this).x, making the declarations ill-formed. This is because P1787R6 removed the old constraint (as referenced in #[class.mfct.non-static]):Suggested resolution: Reintroduce the constraint where appropriate.