<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 442</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="442"></A><H4>442.
  
Incorrect use of null pointer constant in description of delete operator
</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>CD1
 &#160;&#160;&#160;

 <B>Submitter: </B>Matthias Hofmann
 &#160;&#160;&#160;

 <B>Date: </B>2 Dec 2003<BR>


<P>[Voted into WP at October 2005 meeting.]</P>

<P>After some discussion in comp.lang.c++.moderated we came to the conclusion
that there seems to be a defect in
7.6.2.9 [<A href="https://wg21.link/expr.delete">expr.delete</A>]/4, which says:</P>
<BLOCKQUOTE>
The cast-expression in a delete-expression shall be evaluated exactly once.
If the delete-expression calls the implementation deallocation function
(3.7.3.2), and if the operand of the delete expression is not the null
pointer constant, the deallocation function will deallocate the storage
referenced by the pointer thus rendering the pointer invalid. [Note: the
value of a pointer that refers to deallocated storage is indeterminate. ]
</BLOCKQUOTE>
<P>In the second sentence, the term "null pointer constant" should be changed
to "null pointer". In its present form, the passage claims that the
deallocation function will deallocate the storage refered to by a null
pointer that did not come from a null pointer constant in the delete
expression. Besides, how can the null pointer constant be the operand of a
delete expression, as "delete 0" is an error because delete requires a
pointer type or a class type having a single conversion function to a
pointer type?</P>

<P>See also <A HREF="348.html">issue 348</A>.</P>

<P><B>Proposed resolution:</B></P>
<P>
Change the indicated sentence of
7.6.2.9 [<A href="https://wg21.link/expr.delete#4">expr.delete</A>] paragraph 4 as follows:</P>
<BLOCKQUOTE>
If the <I>delete-expression</I> calls the implementation deallocation
function (6.8.6.5.3 [<A href="https://wg21.link/basic.stc.dynamic.deallocation">basic.stc.dynamic.deallocation</A>]), and if
<INS>the value of</INS> the operand of
the delete expression is not <DEL>the</DEL> <INS>a</INS> null
pointer <DEL>constant</DEL>, the deallocation function will deallocate the
storage referenced by the pointer thus rendering the pointer invalid.
</BLOCKQUOTE>

<P><B>Notes from October 2004 meeting:</B></P>

<P>This wording is superseded by, and this issue will be resolved
by, the resolution of <A HREF="348.html">issue 348</A>.</P>

<P><B>Proposed resolution (April, 2005):</B></P>

<P>This issue is resolved by the resolution of <A HREF="348.html">issue 348</A>.</P>

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