<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1503</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="1503"></A><H4>1503.
  
Exceptions during copy to exception object
</H4>
<B>Section: </B>14.2&#160; [<A href="https://wg21.link/except.throw">except.throw</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Daniel Kr&#252;gler
 &#160;&#160;&#160;

 <B>Date: </B>2012-05-11<BR>


<P>[Moved to DR at the April, 2013 meeting.]</P>



<P>According to 14.2 [<A href="https://wg21.link/except.throw#7">except.throw</A>] paragraph 7,</P>

<BLOCKQUOTE>

If the exception handling mechanism, after completing evaluation of
the expression to be thrown but before the exception is caught, calls
a function that exits via an exception, <TT>std::terminate</TT> is
called (14.6.2 [<A href="https://wg21.link/except.terminate">except.terminate</A>]).

</BLOCKQUOTE>

<P>This wording was overlooked in the resolution for <A HREF="475.html">issue 475</A> and should be changed, along with the
following example, to indicate that <TT>std::terminate</TT> will be
called for an uncaught exception only after initialization of the
exception object is complete.</P>

<P><B>Proposed resolution (August, 2012):</B></P>

<P>Change 14.2 [<A href="https://wg21.link/except.throw#7">except.throw</A>] paragraph 7 as follows:</P>

<BLOCKQUOTE>

<P>If the exception handling mechanism, after completing <DEL>evaluation
of the expression to be thrown</DEL> <INS>the initialization of the
exception object</INS> but before the <DEL>exception is caught</DEL>
<INS>activation of a handler for the exception</INS>, calls a function
that exits via an exception, <TT>std::terminate</TT> is called
(14.6.2 [<A href="https://wg21.link/except.terminate">except.terminate</A>]). [<I>Example:</I>
</P>

<PRE>
  struct C {
    C() { }
    C(const C&amp;) { <DEL>throw 0; }</DEL>
<INS>      if (std::uncaught_exception()) {
        throw 0;    //<SPAN CLASS="cmnt"> throw during copy to handler's exception-declaration object (14.4 [<A href="https://wg21.link/except.handle">except.handle</A>])</SPAN>
      }
    }</INS>
  };

  int main() {
    try {
      throw C();   //<SPAN CLASS="cmnt"> calls </SPAN>std::terminate()<SPAN CLASS="cmnt"><INS> if construction of the handler's</INS></SPAN>
<INS>                   //<SPAN CLASS="cmnt"> exception-declaration object is not elided (11.4.5.3 [<A href="https://wg21.link/class.copy.ctor">class.copy.ctor</A>])</SPAN></INS>
    } catch(C) { }
  }
</PRE>

<P>&#8212;<I>end example</I>]</P>

</BLOCKQUOTE>

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