<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2809</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="2809"></A><H4>2809.
  
An implicit definition does not redeclare a function
</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>CD7
 &#160;&#160;&#160;

 <B>Submitter: </B>Brian Bi
 &#160;&#160;&#160;

 <B>Date: </B>2023-09-27<BR>


<P>[Accepted as a DR at the March, 2024 meeting.]</P>

<P>Subclause 9.6.2 [<A href="https://wg21.link/dcl.fct.def.default#5">dcl.fct.def.default</A>] paragraph 5 specifies:</P>

<BLOCKQUOTE>

... A user-provided explicitly-defaulted function (i.e., explicitly
defaulted after its first declaration) is implicitly defined at the
point where it is explicitly defaulted; if such a function is
implicitly defined as deleted, the program is ill-formed. A
non-user-provided defaulted function (i.e., implicitly declared or
explicitly defaulted in the class) that is not defined as deleted is
implicitly defined when it is odr-used (6.3 [<A href="https://wg21.link/basic.def.odr">basic.def.odr</A>]) or
needed for constant evaluation (7.7 [<A href="https://wg21.link/expr.const">expr.const</A>]).

</BLOCKQUOTE>

<P>In the first case, there is a second point of declaration for the
function, wherever the user wrote the definition.  In contrast, there
is no redeclaration for the second case, where the function is not
user-provided.  A note would clarify.</P>

<P><B>Proposed resolution (approved by CWG 2024-03-20):</B></P>

<P>Insert a paragraph break before the quoted section and change in
9.6.2 [<A href="https://wg21.link/dcl.fct.def.default#5">dcl.fct.def.default</A>] paragraph 5 as follows:</P>

<BLOCKQUOTE>

... A function is <I>user-provided</I> if it is user-declared and not
explicitly defaulted or deleted on its first declaration.
A user-provided explicitly-defaulted function (i.e., explicitly
defaulted after its first declaration) is implicitly defined at the
point where it is explicitly defaulted; if such a function is
implicitly defined as deleted, the program is ill-formed.

<INS>[<I>Note 1:</I> Declaring a function as defaulted after its first
declaration can provide efficient execution and concise definition
while enabling a stable binary interface to an evolving code
base. &#8212;<I>end note</I>]</INS>

A non-user-provided defaulted function (i.e., implicitly declared or
explicitly defaulted in the class) that is not defined as deleted is
implicitly defined when it is odr-used (6.3 [<A href="https://wg21.link/basic.def.odr">basic.def.odr</A>]) or
needed for constant evaluation (7.7 [<A href="https://wg21.link/expr.const">expr.const</A>]).

<DEL>[<I>Note 1:</I> Declaring a function as defaulted after its first
declaration can provide efficient execution and concise definition
while enabling a stable binary interface to an evolving code
base. &#8212;<I>end note</I>]</DEL>

<INS>[ Note: The implicit definition of a non-user-provided defaulted
function does not bind any names.  -- end note ]</INS>

</BLOCKQUOTE>

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