<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1344</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="1344"></A><H4>1344.
  
Adding new special member functions to a class via default arguments
</H4>
<B>Section: </B>11.4.5.3&#160; [<A href="https://wg21.link/class.copy.ctor">class.copy.ctor</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Sean Hunt
 &#160;&#160;&#160;

 <B>Date: </B>2011-08-16<BR><BR>


<A href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3903.html#CA29">N3690 comment
  CA&#160;29<BR></A>

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



<P>If default arguments added in the out-of-class definition of a
constructor make it a special member function, this can affect the
overload resolution and thus the implicit exception specification and
the triviality of an implicitly-declared special member function in
a derived class.</P>

<P>See also <A HREF="1496.html">issue 1496</A>, which should also
be addressed by the resolution of this issue.</P>

<P><B>Notes from the September, 2013 meeting:</B></P>

<P>It was decided to resolve this issue separately from
<A HREF="1496.html">issue 1496</A>, which is now decoupled from
this issue.</P>

<P><B>Proposed resolution (September, 2013):</B></P>

<OL>
<LI><P>Change 9.3.4.7 [<A href="https://wg21.link/dcl.fct.default#6">dcl.fct.default</A>] paragraph 6 as follows:</P></LI>

<BLOCKQUOTE>

Except for member functions of class templates, the default arguments in a
member function definition that appears outside of the class definition are
added to the set of default arguments provided by the member function
declaration in the class definition<INS>; the program is ill-formed if a
default constructor (11.4.5 [<A href="https://wg21.link/class.ctor">class.ctor</A>]), copy or move constructor,
or copy or move assignment operator (11.4.5.3 [<A href="https://wg21.link/class.copy.ctor">class.copy.ctor</A>]) is so
declared</INS>. Default arguments for a member function of a class template
shall be specified on the initial declaration of the member function within
the class template. [<I>Example:</I>...

</BLOCKQUOTE>

<LI><P>Delete the following from 11.4.5.3 [<A href="https://wg21.link/class.copy.ctor#7">class.copy.ctor</A>] paragraph 7:
</P></LI>

<BLOCKQUOTE>

<P>...The latter case is deprecated if the class has a user-declared copy
assignment operator or a user-declared destructor. <DEL>Thus, for the class
definition</DEL>
</P>

<PRE>
<DEL>  struct X {
    X(const X&amp;, int);
  };</DEL>
</PRE>

<P><DEL>a copy constructor is implicitly-declared. If the user-declared
constructor is later defined as</DEL></P>

<PRE>
<DEL>  X::X(const X&amp; x, int i =0) { /* ... */ }</DEL>
</PRE>

<P><DEL>then any use of <TT>X</TT>'s copy constructor is ill-formed because
of the ambiguity; no diagnostic is required.</DEL></P>

</BLOCKQUOTE>

</OL>

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