|
| 1 | +<HTML> |
| 2 | +<HEAD> |
| 3 | +<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> |
| 4 | +<TITLE> |
| 5 | + CWG Issue 2911</TITLE> |
| 6 | +<STYLE TYPE="text/css"> |
| 7 | + INS { text-decoration:none; font-weight:bold; background-color:#A0FFA0 } |
| 8 | + .INS { text-decoration:none; background-color:#D0FFD0 } |
| 9 | + DEL { text-decoration:line-through; background-color:#FFA0A0 } |
| 10 | + .DEL { text-decoration:line-through; background-color: #FFD0D0 } |
| 11 | + SPAN.cmnt { font-family:Times; font-style:italic } |
| 12 | +</STYLE> |
| 13 | +</HEAD> |
| 14 | +<BODY> |
| 15 | +<P><EM>This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 |
| 16 | + Core Issues List revision 114b. |
| 17 | + See http://www.open-std.org/jtc1/sc22/wg21/ for the official |
| 18 | + list.</EM></P> |
| 19 | +<P>2024-06-26</P> |
| 20 | +<HR> |
| 21 | +<A NAME="2911"></A><H4>2911. |
| 22 | + |
| 23 | +Unclear meaning of expressions "appearing within" subexpressions |
| 24 | +</H4> |
| 25 | +<B>Section: </B>7.5.7.1  [<A href="https://wg21.link/expr.prim.req.general">expr.prim.req.general</A>] |
| 26 | +     |
| 27 | + |
| 28 | + <B>Status: </B>open |
| 29 | +     |
| 30 | + |
| 31 | + <B>Submitter: </B>Hubert Tong |
| 32 | +     |
| 33 | + |
| 34 | + <B>Date: </B>2024-06-24<BR> |
| 35 | + |
| 36 | + |
| 37 | +<P>(From submission |
| 38 | +<A HREF="https://github.com/cplusplus/CWG/issues/562">#562</A>.)</P> |
| 39 | + |
| 40 | +<P>Subclause 7.5.7.1 [<A href="https://wg21.link/expr.prim.req.general#2">expr.prim.req.general</A>] paragraph 2 specifies:</P> |
| 41 | + |
| 42 | +<BLOCKQUOTE> |
| 43 | + |
| 44 | +A <I>requires-expression</I> is a prvalue of type bool whose value is |
| 45 | +described below. Expressions appearing within |
| 46 | +a <I>requirement-body</I> are unevaluated operands |
| 47 | +(7.2.3 [<A href="https://wg21.link/expr.context">expr.context</A>]). |
| 48 | + |
| 49 | +</BLOCKQUOTE> |
| 50 | + |
| 51 | +<P>A <I>constant-expression</I> used as a non-type template argument |
| 52 | +"appearing within" the <I>requirement-body</I> should not be |
| 53 | +considered an "unevaluated operand". Similarly, bodies |
| 54 | +of <I>lambda-expression</I>s should not be in focus of "appearing |
| 55 | +within".</P> |
| 56 | + |
| 57 | +<P><U>Suggested resolution:</U></P> |
| 58 | + |
| 59 | +<OL> |
| 60 | + |
| 61 | +<LI> |
| 62 | +<P>Change in 7.2.3 [<A href="https://wg21.link/expr.context#1">expr.context</A>] paragraph 1 as follows:</P> |
| 63 | + |
| 64 | +<BLOCKQUOTE> |
| 65 | + |
| 66 | +In some contexts, unevaluated operands appear |
| 67 | +(<DEL>7.5.7 [<A href="https://wg21.link/expr.prim.req">expr.prim.req</A>]</DEL> <INS>7.5.7.2 [<A href="https://wg21.link/expr.prim.req.simple">expr.prim.req.simple</A>], |
| 68 | +7.5.7.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>], |
| 69 | +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>], |
| 70 | +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>], |
| 71 | +13.7.9 [<A href="https://wg21.link/temp.concept">temp.concept</A>]). An unevaluated operand is not evaluated. |
| 72 | + |
| 73 | +</BLOCKQUOTE> |
| 74 | +</LI> |
| 75 | + |
| 76 | +<LI> |
| 77 | +<P>Change in 7.5.7.1 [<A href="https://wg21.link/expr.prim.req.general#2">expr.prim.req.general</A>] paragraph 2 as follows:</P> |
| 78 | + |
| 79 | +<BLOCKQUOTE> |
| 80 | + |
| 81 | +A <I>requires-expression</I> is a prvalue of type bool whose value is |
| 82 | +described below. <DEL>Expressions appearing within |
| 83 | +a <I>requirement-body</I> are unevaluated operands |
| 84 | +(7.2.3 [<A href="https://wg21.link/expr.context">expr.context</A>]).</DEL> |
| 85 | + |
| 86 | +</BLOCKQUOTE> |
| 87 | +</LI> |
| 88 | + |
| 89 | +<LI> |
| 90 | +<P>Change in 7.5.7.2 [<A href="https://wg21.link/expr.prim.req.simple#1">expr.prim.req.simple</A>] paragraph 1 as follows:</P> |
| 91 | + |
| 92 | +<BLOCKQUOTE> |
| 93 | + |
| 94 | +A <I>simple-requirement</I> asserts the validity of an expression. |
| 95 | +<INS>The <I>expression</I> is an unevaluated operand.</INS> |
| 96 | +[<I>Note 1:</I> The enclosing <I>requires-expression</I> will evaluate |
| 97 | +to false if substitution of template arguments into the expression |
| 98 | +fails. <DEL>The expression is an unevaluated operand |
| 99 | +(7.2.3 [<A href="https://wg21.link/expr.context">expr.context</A>]).</DEL> —<I>end note</I>] ... |
| 100 | + |
| 101 | +</BLOCKQUOTE> |
| 102 | +</LI> |
| 103 | + |
| 104 | +<LI> |
| 105 | +<P>Change in 7.5.7.4 [<A href="https://wg21.link/expr.prim.req.compound#1">expr.prim.req.compound</A>] paragraph 1 as follows:</P> |
| 106 | + |
| 107 | +<BLOCKQUOTE> |
| 108 | + |
| 109 | +A <I>compound-requirement</I> asserts properties of the expression |
| 110 | +E. <INS>The <I>expression</I> is an unevaluated operand.</INS> |
| 111 | +Substitution of template arguments (if any) and verification of |
| 112 | +semantic properties proceed in the following order: |
| 113 | + |
| 114 | +</BLOCKQUOTE> |
| 115 | +</LI> |
| 116 | +</OL> |
| 117 | +<BR><BR> |
| 118 | +</BODY> |
| 119 | +</HTML> |
0 commit comments