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


3215. this in a default member initializer during constant evaluation

Section: 7.7.2  [expr.const.core]     Status: open     Submitter: Brian Bi     Date: 2026-07-17

(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: