<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1973</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="1973"></A><H4>1973.
  
Which <I>parameter-declaration-clause</I> in a <I>lambda-expression</I>?
</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>CD7
 &#160;&#160;&#160;

 <B>Submitter: </B>Dinka Ranns
 &#160;&#160;&#160;

 <B>Date: </B>2014-07-16<BR>


<P>[Accepted as a DR at the June, 2023 meeting.]</P>



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

<BLOCKQUOTE>

The closure type for a <I>lambda-expression</I> has a public inline
function call operator (for a non-generic lambda) or function call
operator template (for a generic lambda) (12.4.4 [<A href="https://wg21.link/over.call">over.call</A>])
whose parameters and return type are described by
the <I>lambda-expression</I>'s <I>parameter-declaration-clause</I>
and <I>trailing-return-type</I> respectively, and
whose <I>template-parameter-list</I> consists of the
specified <I>template-parameter-list</I>, if any.

</BLOCKQUOTE>

<P>This is insufficiently precise because the <I>trailing-return-type</I>
might itself contain a <I>parameter-declaration-clause</I>.</P>

<P><U>Suggested resolution [SUPERSEDED]:</U></P>

<P>Change in 7.5.6.1 [<A href="https://wg21.link/expr.prim.lambda.general#5">expr.prim.lambda.general</A>] paragraph 5 as follows:</P>

<BLOCKQUOTE>

If
a <I>lambda-declarator</I> does not <DEL>include a</DEL>
<INS>start with a parenthesized</INS>
<I>parameter-declaration-clause</I>, it is as if <TT>()</TT> were
inserted at the start of the <I>lambda-declarator</I>.
<INS>A <I>lambda-expression</I>'s <I>parameter-declaration-clause</I>
is the (possibly empty) <I>parameter-declaration-clause</I> of
the <I>lambda-expression</I>'s <I>lambda-declarator</I>.</INS>
If the <I>lambda-declarator</I> does not include
a <I>trailing-return-type</I>, the lambda return type is auto, which
is deduced from return statements as described in
9.2.9.7 [<A href="https://wg21.link/dcl.spec.auto">dcl.spec.auto</A>].

</BLOCKQUOTE>

<P><B>Proposed resolution (approved by CWG 2023-02-06):</B></P>

<OL>

<LI>
<P>Change in 7.5.6.2 [<A href="https://wg21.link/expr.prim.lambda.closure#3">expr.prim.lambda.closure</A>] paragraph 3 as follows:</P>

<BLOCKQUOTE>

The closure type for a <I>lambda-expression</I> has a public inline
function call operator (for a non-generic lambda) or function call
operator template (for a generic lambda) (12.4.4 [<A href="https://wg21.link/over.call">over.call</A>])
whose parameters and return type are <DEL>described by</DEL> <INS>those of</INS>
the <I>lambda-expression</I>'s <I>parameter-declaration-clause</I>
and <I>trailing-return-type</I> respectively, and
whose <I>template-parameter-list</I> consists of the
specified <I>template-parameter-list</I>, if any.

</BLOCKQUOTE>
</LI>

<LI>
<P>Change in 7.5.6.1 [<A href="https://wg21.link/expr.prim.lambda.general#5">expr.prim.lambda.general</A>] paragraph 5 as follows:</P>

<BLOCKQUOTE>

<DEL>If a <I>lambda-declarator</I> does not include
a <I>parameter-declaration-clause</I>, it is as if <TT>()</TT> were
inserted at the start of the <I>lambda-declarator</I>.</DEL>
<INS>A <I>lambda-expression</I>'s <I>parameter-declaration-clause</I>
is the <I>parameter-declaration-clause</I> of
the <I>lambda-expression</I>'s <I>lambda-declarator</I>, if any, or empty otherwise.</INS>
If the <I>lambda-declarator</I> does not include
a <I>trailing-return-type</I>, the lambda return type is auto, which
is deduced from return statements as described in
9.2.9.7 [<A href="https://wg21.link/dcl.spec.auto">dcl.spec.auto</A>].

</BLOCKQUOTE>
</LI>

</OL>

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