<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2646</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="2646"></A><H4>2646.
  
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>C++23
 &#160;&#160;&#160;

 <B>Submitter: </B>US
 &#160;&#160;&#160;

 <B>Date: </B>2022-11-03<BR><BR>


<A href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2720r0.pdf#US20-052">P2720R0 comment
  US&#160;20-052<BR></A>

<P>[Accepted as a DR at the November, 2022 meeting.]</P>

<P>The exposition in terms of F1 and F2 as well as T1 and T2 is confusing.</P>

<P><U>Possible resolution:</U></P>

<P>Change in 9.6.2 [<A href="https://wg21.link/dcl.fct.def.default#2">dcl.fct.def.default</A>] paragraph 2 as follows:</P>

<BLOCKQUOTE>

An explicitly defaulted special member function F1 <DEL>with type T1</DEL> is
allowed to differ from the corresponding special member function F2
<DEL>with type T2</DEL> that would have been implicitly declared, as follows:

<UL>

<LI>
<DEL>T1</DEL> <INS>F1</INS> and <DEL>T2</DEL> <INS>F2</INS> may have
differing <I>ref-qualifier</I> s;
</LI>

<LI>
if F2 has an implicit object parameter of type &#8220;reference to
C&#8221;, F1 may be an explicit object member function whose explicit
object parameter is of type &#8220;reference to C&#8221;, in which
case <DEL>T1</DEL> <INS>the type of F1</INS> would differ
from <DEL>T2</DEL> <INS>the type of F2</INS> in
that <DEL>T1</DEL> <INS>the type of F1</INS> has an additional
parameter;
</LI>

<LI>
<DEL>T1</DEL> <INS>F1</INS> and <DEL>T2</DEL> <INS>F2</INS> may have
differing exception specifications; and
</LI>

<LI>
if F2 has a non-object parameter of type const C&amp;, the
corresponding non-object parameter of F1 may be of type C&amp;.
</LI>
</UL>

If <DEL>T1</DEL> <INS>the type of F1</INS> differs
from <DEL>T2</DEL> <INS>the type of F2</INS> in a way other than as
allowed by the preceding rules, then:

<UL>
<LI>
if F1 is an assignment operator, and the return type of
<DEL>T1</DEL> <INS>F1</INS> differs from the return type
of <DEL>T2</DEL> <INS>F2</INS> or F1 's non-object parameter type is
not a reference, the program is ill-formed;
</LI>

<LI>otherwise,
if F1 is explicitly defaulted on its first declaration, it is defined
as deleted;</LI>

<LI>
otherwise, the program is ill-formed.
</LI>

</UL>

</BLOCKQUOTE>

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