<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2911</TITLE>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<STYLE TYPE="text/css">
  INS { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .INS { text-decoration:none; background-color:#D0FFD0 }
  DEL { text-decoration:line-through; background-color:#FFA0A0 }
  .DEL { text-decoration:line-through; background-color: #FFD0D0 }
  @media (prefers-color-scheme: dark) {
    HTML { background-color:#202020; color:#f0f0f0; }
    A { color:#5bc0ff; }
    A:visited { color:#c6a8ff; }
    A:hover, a:focus { color:#afd7ff; }
    INS { background-color:#033a16; color:#aff5b4; }
    .INS { background-color: #033a16; }
    DEL { background-color:#67060c; color:#ffdcd7; }
    .DEL { background-color:#67060c; }
  }
  SPAN.cmnt { font-family:Times; font-style:italic }
</STYLE>
</HEAD>
<BODY>
<P><EM>This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21
  Core Issues List revision 118b.
  See http://www.open-std.org/jtc1/sc22/wg21/ for the official
  list.</EM></P>
<P>2025-09-28</P>
<HR>
<A NAME="2911"></A><H4>2911.
  
Unclear meaning of expressions "appearing within" subexpressions
</H4>
<B>Section: </B>7.5.8.1&#160; [<A href="https://wg21.link/expr.prim.req.general">expr.prim.req.general</A>]
 &#160;&#160;&#160;

 <B>Status: </B>CD7
 &#160;&#160;&#160;

 <B>Submitter: </B>Hubert Tong
 &#160;&#160;&#160;

 <B>Date: </B>2024-06-24<BR>


<P>[Accepted as a DR at the November, 2024 meeting.]</P>

<P>(From submission
<A HREF="https://github.com/cplusplus/CWG/issues/562">#562</A>.)</P>

<P>Subclause 7.5.8.1 [<A href="https://wg21.link/expr.prim.req.general#2">expr.prim.req.general</A>] paragraph 2 specifies:</P>

<BLOCKQUOTE>

A <I>requires-expression</I> is a prvalue of type bool whose value is
described below. Expressions appearing within
a <I>requirement-body</I> are unevaluated operands
(7.2.3 [<A href="https://wg21.link/expr.context">expr.context</A>]).

</BLOCKQUOTE>

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

<P><B>Proposed resolution (approved by CWG 2024-10-11):</B></P>

<OL>

<LI>
<P>Change in 7.2.3 [<A href="https://wg21.link/expr.context#1">expr.context</A>] paragraph 1 as follows:</P>

<BLOCKQUOTE>

In some contexts, unevaluated operands appear
(<DEL>7.5.8 [<A href="https://wg21.link/expr.prim.req">expr.prim.req</A>]</DEL> <INS>7.5.8.2 [<A href="https://wg21.link/expr.prim.req.simple">expr.prim.req.simple</A>],
7.5.8.4 [<A href="https://wg21.link/expr.prim.req.compound">expr.prim.req.compound</A>]</INS>, 7.6.1.8 [<A href="https://wg21.link/expr.typeid">expr.typeid</A>],
7.6.2.5 [<A href="https://wg21.link/expr.sizeof">expr.sizeof</A>], 7.6.2.7 [<A href="https://wg21.link/expr.unary.noexcept">expr.unary.noexcept</A>],
9.2.9.6 [<A href="https://wg21.link/dcl.type.decltype">dcl.type.decltype</A>], 13.1 [<A href="https://wg21.link/temp.pre">temp.pre</A>],
13.7.9 [<A href="https://wg21.link/temp.concept">temp.concept</A>]). An unevaluated operand is not evaluated.

</BLOCKQUOTE>
</LI>

<LI>
<P>Change in 7.5.8.1 [<A href="https://wg21.link/expr.prim.req.general#2">expr.prim.req.general</A>] paragraph 2 as follows:</P>

<BLOCKQUOTE>

A <I>requires-expression</I> is a prvalue of type bool whose value is
described below. <DEL>Expressions appearing within
a <I>requirement-body</I> are unevaluated operands
(7.2.3 [<A href="https://wg21.link/expr.context">expr.context</A>]).</DEL>

</BLOCKQUOTE>
</LI>

<LI>
<P>Change in 7.5.8.2 [<A href="https://wg21.link/expr.prim.req.simple#1">expr.prim.req.simple</A>] paragraph 1 as follows:</P>

<BLOCKQUOTE>

A <I>simple-requirement</I> asserts the validity of an expression.
<INS>The <I>expression</I> is an unevaluated operand.</INS>
[<I>Note 1:</I> The enclosing <I>requires-expression</I> will evaluate
to false if substitution of template arguments into the expression
fails. <DEL>The expression is an unevaluated operand
(7.2.3 [<A href="https://wg21.link/expr.context">expr.context</A>]).</DEL> &#8212;<I>end note</I>] ...

</BLOCKQUOTE>
</LI>

<LI>
<P>Change in 7.5.8.4 [<A href="https://wg21.link/expr.prim.req.compound#1">expr.prim.req.compound</A>] paragraph 1 as follows:</P>

<BLOCKQUOTE>

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

</BLOCKQUOTE>
</LI>
</OL>
<BR><BR>
</BODY>
</HTML>
