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

2024-11-11


2647. Fix for "needed for constant evaluation"

Section: 7.7  [expr.const]     Status: C++23     Submitter: US     Date: 2022-11-03

P2720R0 comment US 17-047

[Accepted as a DR at the November, 2022 meeting.]

The criteria for a variable to be needed for constant evaluation are inconsistent with those for it to be usable in constant expressions (/4).

Proposed resolution (approved by CWG 2022-11-08):

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

    A variable is potentially-constant if it is constexpr or it has reference or non-volatile const-qualified integral or enumeration type.
  2. Change in 7.7 [expr.const] paragraph 16.7 as follows:

    A function or variable is needed for constant evaluation if it is:
    • a constexpr function that is named by an expression (6.3) that is potentially constant evaluated, or
    • a potentially-constant variable named by a potentially constant evaluated expression that is either a constexpr variable or is of non-volatile const-qualified integral type or of reference type.