<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1891</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="1891"></A><H4>1891.
  
Move constructor/assignment for closure class
</H4>
<B>Section: </B>7.5.6.2&#160; [<A href="https://wg21.link/expr.prim.lambda.closure">expr.prim.lambda.closure</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Jonathan Caves
 &#160;&#160;&#160;

 <B>Date: </B>2014-03-10<BR>


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



<P>According to 7.5.6 [<A href="https://wg21.link/expr.prim.lambda#20">expr.prim.lambda</A>] paragraph 20,</P>

<BLOCKQUOTE>

The closure type associated with a <I>lambda-expression</I> has a deleted
(9.6.3 [<A href="https://wg21.link/dcl.fct.def.delete">dcl.fct.def.delete</A>]) default constructor and a deleted copy
assignment operator. It has an implicitly-declared copy constructor
(11.4.5.3 [<A href="https://wg21.link/class.copy.ctor">class.copy.ctor</A>]) and may have an implicitly-declared move
constructor (11.4.5.3 [<A href="https://wg21.link/class.copy.ctor">class.copy.ctor</A>]).

</BLOCKQUOTE>

<P>However, according to 11.4.5.3 [<A href="https://wg21.link/class.copy.ctor#9">class.copy.ctor</A>] paragraph 9,</P>

<BLOCKQUOTE>

<P>If the definition of a class <TT>X</TT> does not explicitly declare a move
constructor, one will be implicitly declared as defaulted if and only if</P>

<UL>
<LI><P>
<TT>X</TT> does not have a user-declared copy
constructor,</P></LI>

<LI><P>
<TT>X</TT> does not have a user-declared copy assignment
operator,</P></LI>

<LI><P>
<TT>X</TT> does not have a user-declared move assignment operator,
and</P></LI>

<LI><P>
<TT>X</TT> does not have a user-declared destructor.</P></LI>

</UL>

</BLOCKQUOTE>

<P>It is not clear how this applies to the closure class.  Would it be
better to state that the closure class has a defaulted move constructor
and a defaulted move assignment operator?  There is already wording that
handles the case if they are ultimately defined as deleted.</P>

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

<P>Change 7.5.6 [<A href="https://wg21.link/expr.prim.lambda#20">expr.prim.lambda</A>] paragraph 20 as follows:</P>

<BLOCKQUOTE>

The closure type associated with a <I>lambda-expression</I>
has <DEL>a deleted
(9.6.3 [<A href="https://wg21.link/dcl.fct.def.delete">dcl.fct.def.delete</A>])</DEL> <INS>no</INS> default
constructor and a deleted copy assignment operator. It has
<DEL>an implicitly-declared</DEL> <INS>a defaulted</INS> copy constructor
<DEL>(11.4.5.3 [<A href="https://wg21.link/class.copy.ctor">class.copy.ctor</A>]) and may have an
implicitly-declared</DEL> <INS>and a defaulted</INS> move
constructor (11.4.5.3 [<A href="https://wg21.link/class.copy.ctor">class.copy.ctor</A>]). [<I>Note:</I> <DEL>The
copy/move constructor is implicitly defined in the same way
as any other implicitly declared copy/move constructor would
be implicitly defined</DEL> <INS>These special member functions are
implicitly defined as usual, and might therefore be defined as
deleted</INS>. &#8212;<I>end note</I>]

</BLOCKQUOTE>

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