<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2728</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="2728"></A><H4>2728.
  
Evaluation of conversions in a <I>delete-expression</I>
</H4>
<B>Section: </B>7.6.2.9&#160; [<A href="https://wg21.link/expr.delete">expr.delete</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Jiang An
 &#160;&#160;&#160;

 <B>Date: </B>2023-05-05<BR>


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

<P>Subclause 7.6.2.9 [<A href="https://wg21.link/expr.delete#4">expr.delete</A>] paragraph 4 specifies:</P>

<BLOCKQUOTE>

The <I>cast-expression</I> in a <I>delete-expression</I> shall be
evaluated exactly once.

</BLOCKQUOTE>

<P>Due to the reference to the syntactic
non-terminal <I>cast-expression</I>, it is unclear whether that
includes the conversion to pointer type specified in
7.6.2.9 [<A href="https://wg21.link/expr.delete#2">expr.delete</A>] paragraph 2.</P>

<P><B>Proposed resolution (approved by CWG 2024-03-01) [SUPERSEDED]:</B></P>

<OL>
<LI>
<P>Change in 7.6.2.9 [<A href="https://wg21.link/expr.delete#1">expr.delete</A>] paragraph 1 and paragraph 2 as
follows:</P>

<BLOCKQUOTE>

<P>
... The operand shall be <INS>of class type or a prvalue</INS> of
pointer to object type<DEL> or of class type</DEL>. If of class type,
the operand is contextually implicitly converted
(7.3 [<A href="https://wg21.link/conv">conv</A>]) to a <INS>prvalue</INS> pointer to object
type. [ Footnote: ... ]
<INS>The converted operand is used in place of the original operand
for the remainder of this subclause.</INS>
The <I>delete-expression</I> has type void.
</P>

<P>
<DEL>If the operand has a class type, the operand is converted to a
pointer type by calling the above-mentioned conversion function, and
the converted operand is used in place of the original operand for the
remainder of this subclause.</DEL> ... </P>

</BLOCKQUOTE>
</LI>

<LI>
<P>Change in 7.6.2.9 [<A href="https://wg21.link/expr.delete#4">expr.delete</A>] paragraph 4 as follows:</P>

<BLOCKQUOTE>

The <DEL><I>cast-expression</I> in</DEL> <INS>operand of</INS>
a <I>delete-expression</I> shall be evaluated exactly once.

</BLOCKQUOTE>
</LI>

</OL>

<P><B>Proposed resolution (approved by CWG 2024-03-20):</B></P>

<OL>
<LI>
<P>Change in 7.6.2.9 [<A href="https://wg21.link/expr.delete#1">expr.delete</A>] paragraph 1 and paragraph 2 as
follows:</P>

<BLOCKQUOTE>

<P>... The first alternative is a single-object delete expression, and
the second is an array delete expression. Whenever the delete keyword
is immediately followed by empty square brackets, it shall be
interpreted as the second alternative. [ Footnote: ... ] If the
operand is of class type, it is contextually implicitly converted
(7.3 [<A href="https://wg21.link/conv">conv</A>]) to a pointer to object type <INS>and the
converted operand is used in place of the original operand for the
remainder of this subclause</INS>. <DEL>[ Footnote: ...]</DEL>  Otherwise, it
shall be a prvalue of pointer to object
type. The <I>delete-expression</I> has type void.
</P>

<P>
<DEL>If the operand has a class type, the operand is converted to a
pointer type by calling the above-mentioned conversion function, and
the converted operand is used in place of the original operand for the
remainder of this subclause.</DEL> ...</P>

</BLOCKQUOTE>
</LI>

<LI>
<P>Delete 7.6.2.9 [<A href="https://wg21.link/expr.delete#4">expr.delete</A>] paragraph 4:</P>

<BLOCKQUOTE>

<DEL>The <I>cast-expression</I> in a <I>delete-expression</I> shall be
evaluated exactly once.</DEL>

</BLOCKQUOTE>
</LI>

</OL>

<BR><BR>
</BODY>
</HTML>
