This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 120c. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2026-08-20
(From submission #949.)
Consider:
constexpr struct A {
A* p = this;
} a;
This use of this during constant evaluation is not, but ought to be, permitted by 7.7.2 [expr.const.core] paragraph 2.1.
Suggested resolution:
Change in 7.7.2 [expr.const.core] bullet 2.1 as follows:
An expression E is a core constant expression unless the evaluation of E, following the rules of the abstract machine (6.10.1 [intro.execution]), would evaluate one of the following:
- this (7.5.3 [expr.prim.this]), except
- in a constexpr function (9.2.6 [dcl.constexpr]) that is being evaluated as part of E,
or- in a default member initializer for an object that is being initialized as part of E, or
- when appearing as the postfix-expression of an implicit or explicit class member access expression (7.6.1.5 [expr.ref]);
- ...