<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1552</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="1552"></A><H4>1552.
  
<I>exception-specification</I>s and defaulted special member functions
</H4>
<B>Section: </B>9.6.2&#160; [<A href="https://wg21.link/dcl.fct.def.default">dcl.fct.def.default</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Daveed Vandevoorde
 &#160;&#160;&#160;

 <B>Date: </B>2012-09-07<BR>


<P>[Moved to DR at the November, 2014 meeting.]</P>

<P>The current wording of 9.6.2 [<A href="https://wg21.link/dcl.fct.def.default#2">dcl.fct.def.default</A>] paragraph 2 has some
surprising implications:</P>

<BLOCKQUOTE>

An explicitly-defaulted function may be declared <TT>constexpr</TT> only if it
would have been implicitly declared as <TT>constexpr</TT>, and may have an
explicit <I>exception-specification</I> only if it is compatible
(14.5 [<A href="https://wg21.link/except.spec">except.spec</A>]) with the <I>exception-specification</I> on
the implicit declaration.

</BLOCKQUOTE>

<P>In an example like</P>

<PRE>
  struct A {
    A&amp; operator=(A&amp;);
  };
  A&amp; A::operator=(A&amp;) = default;
</PRE>

<P>presumably the <I>exception-specification</I> of
<TT>A::operator=(A&amp;)</TT> is <TT>noexcept(false)</TT>.  However,
attempting to make that <I>exception-specification</I> explicit,</P>

<PRE>
  A&amp; A::operator=(A&amp;) noexcept(false) = default;
</PRE>

<P>is an error.  Is this intentional?</P>

<P><B>Proposed resolution (February, 2014):</B></P>

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

<BLOCKQUOTE>

...If any declaration of a pointer to function, reference to function, or
pointer to member function has an <I>exception-specification</I>, all
occurrences of that declaration shall have a compatible
<I>exception-specification</I><INS>. If a declaration of a function
has an implicit <I>exception-specification</I>, other declarations of the
function shall not specify an <I>exception-specification</I>.</INS> In an
explicit instantiation...

</BLOCKQUOTE>

<P>(This resolution also resolves <A HREF="1492.html">issue 1492</A>.)</P>

<P><B>Additional note (January, 2013):</B></P>

<P>The resolution conflicts with the current specification of
<TT>operator delete</TT>: in 6.8.6.5 [<A href="https://wg21.link/basic.stc.dynamic#2">basic.stc.dynamic</A>] paragraph 2,
the two <TT>operator delete</TT> overloads are declared with an
implicit exception specification, while in 17.6 [<A href="https://wg21.link/support.dynamic#1">support.dynamic</A>] paragraph 1,
 they are declared as <TT>noexcept</TT>.
</P>

<P><B>Additional note (February, 2014):</B></P>

<P>The overloads cited in the preceding note have been independently
changed in N3936 to include a <TT>noexcept</TT> specification,
making the proposed resolution correct as it stands.</P>

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