Title
Evaluation context is missing synthesized points
Status
open
Section
7.7 [expr.const]
Submitter
Dan Katz

Created on 2025-11-15.00:00:00 last changed 3 weeks ago

Messages

Date: 2025-12-05.22:18:07

Possible resolution:

Change in 7.7 [expr.const] paragraph 32 as follows:

... During the evaluation V of an expression E as a core constant expression, the evaluation context of an evaluation X (6.10.1 [intro.execution]) consists of the following points:
  • The program point EVAL-PT(L) and any synthesized point in the instantiation context thereof, where L is the point at which E appears, and where EVAL-PT(P ), for a point P , is a point R determined as follows:
    • ...
  • Each synthesized point corresponding to an injected declaration produced by any evaluation sequenced before X (6.10.1 [intro.execution]).
Date: 2025-11-15.00:00:00

(From submission #810.)

Consider:

  template <typename T>
  struct TCls {
    T mem;
    static_assert(size_of(^^T) > 0); // <-- problem
  };

  struct S;
  consteval {
   constexpr auto ctx = std::meta::access_context::current();

   if (nonstatic_data_members_of(substitute(^^TCls, {define_aggregate(^^S, {})}), ctx).size() > 1)
    throw "contrived, but whatever";
  }

Nothing in the definition of "evaluation context" takes the synthesized point associated with S from the instantiation context of TCls<S> into the evaluation context of the static assertion.

History
Date User Action Args
2025-11-18 22:21:13adminsetmessages: + msg8398
2025-11-15 00:00:00admincreate