<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 220</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="220"></A><H4>220.
  
All deallocation functions should be required not to throw
</H4>
<B>Section: </B>6.8.6.5.3&#160; [<A href="https://wg21.link/basic.stc.dynamic.deallocation">basic.stc.dynamic.deallocation</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Herb Sutter
 &#160;&#160;&#160;

 <B>Date: </B>31 Mar 2000<BR>


<P>[Voted into the WP at the September, 2008 meeting (resolution
in paper N2757).]</P>

<P>[Picked up by evolution group at October 2002 meeting.]</P>



<P>The default global operators <TT>delete</TT> are specified to not
throw, but there is no requirement that replacement global, or
class-specific, operators <TT>delete</TT> must not throw. That ought
to be required.</P>

<P>In particular:</P>

<UL>

<LI>6.8.6.5.3 [<A href="https://wg21.link/basic.stc.dynamic.deallocation#2">basic.stc.dynamic.deallocation</A>] paragraph 2, at the end of the
first sentence, should also require that no exceptions be thrown.</LI>

<LI>11.4.11 [<A href="https://wg21.link/class.free">class.free</A>], including its examples, should require
nonthrowing class-specific <TT>operator delete</TT>.</LI>

<LI>16.4.5.6 [<A href="https://wg21.link/replacement.functions#2">replacement.functions</A>] paragraph 2 should append
<TT>throw()</TT> to the signature of each of the four operators
<TT>delete</TT>.</LI>

</UL>

<P>We already require that all versions of an allocator's deallocate()
must not throw, so that part is okay.</P>

<P><B>Rationale (04/00):</B></P>

<OL>

<LI>Replacement deallocation functions are already required not to
throw an exception (cf 16.4.5.8 [<A href="https://wg21.link/res.on.functions#2">res.on.functions</A>] paragraph 2,
as applied to 17.6.3.2 [<A href="https://wg21.link/new.delete.single#12">new.delete.single</A>] paragraph 12 and
17.6.3.3 [<A href="https://wg21.link/new.delete.array#11">new.delete.array</A>] paragraph 11).</LI>

<LI>Section 16.4.5.6 [<A href="https://wg21.link/replacement.functions">replacement.functions</A>] is describing the
signatures of the functions to be replaced; exception specfications
are not part of the signature.</LI>

<LI>There does not appear to be any pressing need to require that
class member deallocation functions not throw.</LI>

</OL>

<P><B>Note (March, 2008):</B></P>

<P>The Evolution Working Group has accepted the intent of this issue
and referred it to CWG for action for C++0x (see paper
J16/07-0033 = WG21 N2173).</P>

<P><B>Proposed resolution (March, 2008):</B></P>

<P>Change 6.8.6.5.3 [<A href="https://wg21.link/basic.stc.dynamic.deallocation#3">basic.stc.dynamic.deallocation</A>] paragraph 3 as follows:</P>

<BLOCKQUOTE>

<INS>A deallocation function shall not terminate by throwing an
exception.</INS>
The value of the first argument supplied to a deallocation function...

</BLOCKQUOTE>

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