<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 127</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="127"></A><H4>127.
  
Ambiguity in description of matching deallocation function
</H4>
<B>Section: </B>7.6.2.8&#160; [<A href="https://wg21.link/expr.new">expr.new</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Alexander Schiemann
 &#160;&#160;&#160;

 <B>Date: </B>8 June 1999<BR>



<P>If a placement allocation function has default arguments for all its
parameters except the first, it can be called using non-placement
syntax.  In such a case, it is not clear whether
the deallocation function to be called if the constructor terminates
by throwing an expression is determined on the basis of
the syntax of the <I>new-expression</I> (i.e., a non-placement
deallocation function)
or the declaration of the selected (placement) allocation function.
7.6.2.8 [<A href="https://wg21.link/expr.new#19">expr.new</A>] paragraph 19
indicates
that the deallocation function must match the declaration of the
allocation function.
However, 14.3 [<A href="https://wg21.link/except.ctor">except.ctor</A>]
 says that the
distinction is based on whether the <I>new-expression</I> contains
a <I>new-placement</I> or not.</P>

<P><B>Proposed resolution (10/00):</B></P>

<P>In 14.3 [<A href="https://wg21.link/except.ctor#2">except.ctor</A>] paragraph 2, replace</P>

<BLOCKQUOTE>

If the object or array was allocated in a <I>new-expression</I> and
the <I>new-expression</I> does not contain a <I>new-placement</I>, the
deallocation function (6.8.6.5.3 [<A href="https://wg21.link/basic.stc.dynamic.deallocation">basic.stc.dynamic.deallocation</A>], 11.4.11 [<A href="https://wg21.link/class.free">class.free</A>]) is called to free the storage occupied by the object;
the deallocation function is chosen as specified in 7.6.2.8 [<A href="https://wg21.link/expr.new">expr.new</A>]. If the object or array was allocated in a
<I>new-expression</I> and the <I>new-expression</I> contains a
<I>new-placement</I>, the storage occupied by the object is
deallocated only if an appropriate placement operator delete is found,
as specified in 7.6.2.8 [<A href="https://wg21.link/expr.new">expr.new</A>].

</BLOCKQUOTE>

<P>with</P>

<BLOCKQUOTE>

If the object or array was allocated in a <I>new-expression</I>, the
matching deallocation function (6.8.6.5.3 [<A href="https://wg21.link/basic.stc.dynamic.deallocation">basic.stc.dynamic.deallocation</A>],
7.6.2.8 [<A href="https://wg21.link/expr.new">expr.new</A>], 11.4.11 [<A href="https://wg21.link/class.free">class.free</A>]), if any, is
called to free the storage occupied by the object.

</BLOCKQUOTE>

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

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