<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1216</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="1216"></A><H4>1216.
  
Exceptions &#8220;allowed&#8221; by a <I>noexcept-specification</I>
</H4>
<B>Section: </B>14.5&#160; [<A href="https://wg21.link/except.spec">except.spec</A>]
 &#160;&#160;&#160;

 <B>Status: </B>C++11
 &#160;&#160;&#160;

 <B>Submitter: </B>Jens Maurer
 &#160;&#160;&#160;

 <B>Date: </B>2010-11-02<BR>


<P>[Voted into the WP at the March, 2011 meeting as part of paper N3262.]</P>



<P>According to 14.5 [<A href="https://wg21.link/except.spec">except.spec</A>] paragraph2 8 and 9,</P>

<BLOCKQUOTE>

<P>A function is said to <I>allow</I> an exception of type <TT>E</TT>
if its <I>dynamic-exception-specification</I> contains a type
<TT>T</TT> for which a handler of type <TT>T</TT> would be a match
(14.4 [<A href="https://wg21.link/except.handle">except.handle</A>]) for an exception of type <TT>E</TT>.</P>

<P>Whenever an exception is thrown and the search for a handler
(14.4 [<A href="https://wg21.link/except.handle">except.handle</A>]) encounters the outermost block of a
function with an <I>exception-specification</I> that does not allow
the exception, then,</P>

<UL>
<LI><P>if the <I>exception-specification</I> is a
<I>dynamic-exception-specification</I>, the function
<TT>std::unexpected()</TT> is called (_N4606_.15.5.2 [<A href="https://wg21.link/except.unexpected">except.unexpected</A>]),</P></LI>

<LI><P>otherwise, the function <TT>std::terminate()</TT> is called
(14.6.2 [<A href="https://wg21.link/except.terminate">except.terminate</A>]).</P></LI>

</UL>

</BLOCKQUOTE>

<P>This does not define what it means for a <I>noexcept-specification</I>
to allow an exception.</P>

<P><B>Proposed resolution (November, 2010) [SUPERSEDED]:</B></P>

<P>Change 14.5 [<A href="https://wg21.link/except.spec#8">except.spec</A>] paragraph 8 as follows:</P>

<BLOCKQUOTE>

A function is said to <I>allow</I> an exception of type <TT>E</TT> if
<INS>the <I>constant-expression</I> in its
<I>noexcept-specification</I> evaluates to <TT>false</TT> or</INS> its
<I>dynamic-exception-specification</I> contains a type <TT>T</TT> for
which a handler of type <TT>T</TT> would be a match (14.4 [<A href="https://wg21.link/except.handle">except.handle</A>]) for an exception of type <TT>E</TT>.

</BLOCKQUOTE>

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