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

2025-11-07


3115. Function parameters of consteval-only type

Section: 6.9.1  [basic.types.general]     Status: ready     Submitter: Hubert Tong     Date: 2025-10-29

The properties of functions with consteval-only parameters are unclear.

Proposed resolution (approved by CWG 2025-11-04):

  1. Change in 6.9.1 [basic.types.general] paragraph 12 as follows:

    A type is consteval-only if it is either std::meta::info or a type compounded from a consteval-only type (6.9.4 [basic.compound]). Every object of consteval-only type shall be
    • the object associated with a constexpr variable or a subobject thereof,
    • a template parameter object (13.2 [temp.param]) or a subobject thereof, or
    • an object whose lifetime begins and ends during the evaluation of a core constant expression.
    Every function of consteval-only type shall be an immediate function (7.7 [expr.const]).
  2. Change in 7.7 [expr.const] paragraph 27 as follows:

    An immediate function is a function that is either
    • declared with the consteval specifier, or
    • an immediate-escalating function whose type is consteval-only (6.9.1 [basic.types.general]), or
    • an immediate-escalating function F whose function body contains either
      • an immediate-escalating expression or
      • a definition of a non-constexpr variable with consteval-only type
      whose innermost enclosing non-block scope is F 's function parameter scope. [Note 11: Default member initializers used to initialize a base or member subobject (11.9.3 [class.base.init]) are considered to be part of the function body (9.6.1 [dcl.fct.def.general]). —end note]
    ...