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-19


2911. Unclear meaning of expressions "appearing within" subexpressions

Section: 7.5.8.1  [expr.prim.req.general]     Status: ready     Submitter: Hubert Tong     Date: 2024-06-24

(From submission #562.)

Subclause 7.5.8.1 [expr.prim.req.general] paragraph 2 specifies:

A requires-expression is a prvalue of type bool whose value is described below. Expressions appearing within a requirement-body are unevaluated operands (7.2.3 [expr.context]).

A constant-expression used as a non-type template argument "appearing within" the requirement-body should not be considered an "unevaluated operand". Similarly, bodies of lambda-expressions should not be in focus of "appearing within".

Proposed resolution (approved by CWG 2024-10-11):

  1. Change in 7.2.3 [expr.context] paragraph 1 as follows:

    In some contexts, unevaluated operands appear (7.5.8 [expr.prim.req] 7.5.8.2 [expr.prim.req.simple], 7.5.8.4 [expr.prim.req.compound], 7.6.1.8 [expr.typeid], 7.6.2.5 [expr.sizeof], 7.6.2.7 [expr.unary.noexcept], 9.2.9.6 [dcl.type.decltype], 13.1 [temp.pre], 13.7.9 [temp.concept]). An unevaluated operand is not evaluated.
  2. Change in 7.5.8.1 [expr.prim.req.general] paragraph 2 as follows:

    A requires-expression is a prvalue of type bool whose value is described below. Expressions appearing within a requirement-body are unevaluated operands (7.2.3 [expr.context]).
  3. Change in 7.5.8.2 [expr.prim.req.simple] paragraph 1 as follows:

    A simple-requirement asserts the validity of an expression. The expression is an unevaluated operand. [Note 1: The enclosing requires-expression will evaluate to false if substitution of template arguments into the expression fails. The expression is an unevaluated operand (7.2.3 [expr.context]).end note] ...
  4. Change in 7.5.8.4 [expr.prim.req.compound] paragraph 1 as follows:

    A compound-requirement asserts properties of the expression E. The expression is an unevaluated operand. Substitution of template arguments (if any) and verification of semantic properties proceed in the following order: