220 29870 <cba1a1fa-d3c8-43e0-a1b5-f69fb285a680@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Vittorio Romeo <vittorio.romeo.vee@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Extending the scope of generalized lambda
 captures to include the lambda's trailing return type
Date: Sat, 17 Dec 2016 07:14:30 -0800 (PST)
Lines: 576
Approved: news@gmane.org
Message-ID: <cba1a1fa-d3c8-43e0-a1b5-f69fb285a680@isocpp.org>
References: <f804aae4-6aeb-4239-9deb-23c9daeed950@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_779_216450449.1481987670360"
X-Trace: blaine.gmane.org 1481987676 5933 195.159.176.226 (17 Dec 2016 15:14:36 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 17 Dec 2016 15:14:36 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCO3NDEYZQHRBV5M2XBAKGQE5D2YLWA@isocpp.org Sat Dec 17 16:14:31 2016
Return-path: <std-proposals+bncBCO3NDEYZQHRBV5M2XBAKGQE5D2YLWA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f198.google.com ([209.85.217.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCO3NDEYZQHRBV5M2XBAKGQE5D2YLWA@isocpp.org>)
	id 1cIGgt-0000Jz-JA
	for gclcip-std-proposals@m.gmane.org; Sat, 17 Dec 2016 16:14:27 +0100
Original-Received: by mail-ua0-f198.google.com with SMTP id 3sf68510191uaz.2
        for <gclcip-std-proposals@m.gmane.org>; Sat, 17 Dec 2016 07:14:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=NRN3BxNWEKxOjtRIvKxYjue/b3j7daSJCWrkXZm3gV0=;
        b=CZtA8hftnIgmF+mfKOkYRxKcBvsTOY3mwO1Jeip2LGwUuInHGiJtD0V14vCqW8F9cv
         xgJX/takMOHmRfgnZsQt4ByfS/hFXL7YnjKN/7s++3edX1HPOSvBA8iK0wxtEssVZ3EP
         LCa7w3o9PiMJNGFBmZjoynESHWm+lNwugIeyMNV0UUzZsNmmWV8+7lnTTOHaCWTnjzaQ
         ACtIRYjU7TpLqf1UIKgUsXhCGGGd9BDok5B87v00MJI5GHwrQx56QlkHvqeIJ4s+Cq4C
         VuVjmOO0Pi/X+9iynEzwqEzx2CRtnqU6k7QRnHTdEnuLL/jorLqdeb9mUWwDw+Uo2ge1
         GWbg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=NRN3BxNWEKxOjtRIvKxYjue/b3j7daSJCWrkXZm3gV0=;
        b=MawyoSTVEwt5VqqMKZTChcB0uo5i5Xys4cHXD0CbL70YZGq6Yu/ZN93NMaaSMQVwgt
         iVu2qKoJbcgaB/3jf2gz+5i8RgZ5OZiKxB2yp/wYyUuVCyRbmrv5fr6ig18XpaJTqnfP
         DFgp7IGILxYI3KilJGdoM9gw6U0YicNgZSDKKiSflACnw0QzxlOv+1kWj0q740iDFw+N
         j92HItN3Wm7R+AjGNlSeM21r80AQsBib8N7NBxsZAxQPnJLdfNQieYlyO3kMkhzaUskP
         8+nCwKUBDM7BHZ39yLabUGwDWoCH7gy9GwLxkJ2yfugFH4U4JQjeMDGgJ/ep4ILV9THc
         yHcQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=NRN3BxNWEKxOjtRIvKxYjue/b3j7daSJCWrkXZm3gV0=;
        b=MZwHrYnF1nkN2/ackZIR0UDls3o07nL9NmW2mYrom3kaUlQ+0Hr0zTLdJv7t65uGqu
         pnp4Pr04c9Pi4CImiCQGUyQDcEj8GvNLjbNhYO3vOiOBZL0sR8B2xm89zVzkAk7aibhK
         6Vb8y3hjTGAMgFiHQXXOONB0TIfem4CX7EDhAUSRpHC+2qBg85oNr2EEOx05i11jyyFC
         op7AKGy8U4BIA+mFPJvmTE1SFCqjKZHRU9iE/DNtPQTI5+yBzTZeEg8lnWAo4NgaLQaV
         Popcq1kOY5bNhs0NOP/IZ3QlndLagUX1pEP3Nww0uECCS/qFLmQZTlg0hBM9Ykqz9Snp
         YFPg==
X-Gm-Message-State: AIkVDXIRM9ZZKkObhTV10Y6JZMSaK0qx5LUsJF/xzCjH5tVcEZWWw57j8VPzxZPbKFX0nQ==
X-Received: by 10.31.207.70 with SMTP id f67mr1369566vkg.41.1481987671802;
        Sat, 17 Dec 2016 07:14:31 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.27.137 with SMTP id z9ls11875656otd.28.gmail; Sat, 17 Dec
 2016 07:14:30 -0800 (PST)
X-Received: by 10.157.27.9 with SMTP id l9mr453996otl.6.1481987670923;
        Sat, 17 Dec 2016 07:14:30 -0800 (PST)
In-Reply-To: <f804aae4-6aeb-4239-9deb-23c9daeed950@isocpp.org>
X-Original-Sender: vittorio.romeo.vee@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:29870
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29870>

------=_Part_779_216450449.1481987670360
Content-Type: multipart/alternative; 
	boundary="----=_Part_780_1476758788.1481987670362"

------=_Part_780_1476758788.1481987670362
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Thank you very much for the feedback.

Here's a new draft:
https://vittorioromeo.info/Misc/lambda_issue_draft_2.html

I've looked into most of the issues/inconsistencies you suggested, and I=20
came to the conclusion that also simple-captures need to be "visible" in=20
the lambda-declarator.
I'm not sure if the proposed wording is correct (and I'm not sure how I=20
should address captures by reference, as they're not covered by =C2=A75.1.5=
/17=20
<https://timsong-cpp.github.io/cppwp/expr.prim.lambda#17>).

Some questions/feedback requests:
* Any idea for a title that clearly conveys the intent of making both=20
simple-captures and init-captures usable in the lambda-declarator in order=
=20
to achieve consistency with classes?
* Are the proposed changes to the standard reasonable? Would the addition=
=20
of a new paragraph make it clearer that all types of captures should be=20
accessible in the lambda-declarator for consistency with classes?
* The last example posted by Arthur
    int i;
    auto f =3D [i=3D0L](char i) -> decltype(i) { return 0; }
    // decltype(f(0)) =3D=3D ???
is something that the paper should address, after the change in scope. I am=
=20
not sure where to start here though, as I'm confident that multiple rules=
=20
from different parts of the standard come into play here.=20
Intuitively I think that the return type should evaluate to `char` (as the=
=20
parameter `i` is closer to the trailing return type). What do you think? =
=20


On Thursday, 15 December 2016 13:27:06 UTC, Vittorio Romeo wrote:
>
> int main(){
>     auto l =3D [x =3D 10]() -> decltype(x) {};}
>
>
>
>
>    -=20
>   =20
>    *clang++ 4.0* rejects this code=20
>    <http://melpon.org/wandbox/permlink/zsFICgiaMhCrIIwe> with the=20
>    following error:
>    -=20
>   =20
>    error: use of undeclared identifier 'x'
>            auto l =3D [x =3D 10]() -> decltype(x) {};
>                                            ^
>   =20
>    -=20
>   =20
>    *g++ 7* rejects this code=20
>    <http://melpon.org/wandbox/permlink/LXamt4MieU6n77Xs> with the=20
>    following error:
>   =20
>    In function 'int main()':
>    error: 'x' was not declared in this scope
>      auto l =3D [x =3D 10]() -> decltype(x) {};
>                                      ^
>    error: 'x' was not declared in this scopeIn lambda function:
>    warning: no return statement in function returning non-void [-Wreturn-=
type]
>      auto l =3D [x =3D 10]() -> decltype(x) {};
>                                      ^
>   =20
>   =20
>   =20
> I posted this today on StackOverflow thinking it was a compiler bug:
> http://stackoverflow.com/questions/41162200/
>
> But it's not - the standard says that the scope of `x` is limited to the=
=20
> body of the lambda. This answer has the details:=20
> http://stackoverflow.com/a/41162972/598696
> (quoted below)
>
> ---
>
> *TL;DR*: Compilers behave as expected.
>
> The standard defines lambda semantics as follows [expr.prim.lambda,=20
> section 1]:
>
> lambda-expression:
>
>    lambda-introducer lambda-declarator_opt compound-statement
>
> Here *compound-statement* is just the body of lambda between {}, because=
=20
> everything else is included in *lambda-declarator*:
>
> lambda-declarator:
>
>    ( parameter-declaration-clause ) decl-specifier-seq_opt
>        exception-specification_opt attribute-specifier-seq_opt trailing-r=
eturn-type_opt
>
> Also, in section 12 of the same chapter, it's said that
>
> An init-capture behaves as if it declares and explicitly captures a=20
> variable of the form =E2=80=9Cauto init-capture ;=E2=80=9D whose declarat=
ive region is the=20
> lambda-expression=E2=80=99s compound-statement, except that:
>
> (12.1) =E2=80=94 if the capture is by copy (see below), the non-static da=
ta member=20
> declared for the capture and the variable are treated as two different wa=
ys=20
> of referring to the same object, which has the lifetime of the non-static=
=20
> data member, and no additional copy and destruction is performed, and
>
> (12.2) =E2=80=94 if the capture is by reference, the variable=E2=80=99s l=
ifetime ends when=20
> the closure object=E2=80=99s lifetime ends.
>
> So, in your first example, variable x scope is the lambda body only, not=
=20
> including the decltypeexpression. In the second example, obviously, x sco=
pe=20
> is the function main.
>
> ---
>
> Do you think that writing a proposal to relax these rules and to=20
> explicitly allow generalized captures to be used inside the trailing retu=
rn=20
> type would be worthwhile?
>
> One possible use case is when the generalized captures are initialized=20
> with complex expressions. I encountered this while experimenting today (
> http://melpon.org/wandbox/permlink/aVasfHaK6boC6NZt).
> In general, it would be beneficial to have this feature whenever the=20
> generalized capture is used as part of the return expression in the lambd=
a=20
> body.
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/cba1a1fa-d3c8-43e0-a1b5-f69fb285a680%40isocpp.or=
g.

------=_Part_780_1476758788.1481987670362
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thank you very much for the feedback.<br><br>Here&#39;s a =
new draft:<br><a href=3D"https://vittorioromeo.info/Misc/lambda_issue_draft=
_2.html">https://vittorioromeo.info/Misc/lambda_issue_draft_2.html</a><div>=
<br></div><div>I&#39;ve looked into most of the issues/inconsistencies you =
suggested, and I came to the conclusion that also simple-captures need to b=
e &quot;visible&quot; in the lambda-declarator.<br>I&#39;m not sure if the =
proposed wording is correct (and I&#39;m not sure how I should address capt=
ures by reference, as they&#39;re not covered by=C2=A0<a href=3D"https://ti=
msong-cpp.github.io/cppwp/expr.prim.lambda#17" style=3D"font-family: &quot;=
Times New Roman&quot;; font-size: medium;">=C2=A75.1.5/17</a>).<br><br>Some=
 questions/feedback requests:</div><div>* Any idea for a title that clearly=
 conveys the intent of making both simple-captures and init-captures usable=
 in the lambda-declarator in order to achieve consistency with classes?<br>=
* Are the proposed changes to the standard reasonable? Would the addition o=
f a new paragraph make it clearer that all types of captures should be acce=
ssible in the lambda-declarator for consistency with classes?<br>* The last=
 example posted by Arthur<br><span style=3D"font-family: monospace; backgro=
und-color: rgb(250, 250, 250); color: rgb(0, 0, 0);">=C2=A0 =C2=A0=C2=A0</s=
pan><span style=3D"font-family: monospace; background-color: rgb(250, 250, =
250); color: rgb(0, 0, 136);">int</span><span style=3D"font-family: monospa=
ce; background-color: rgb(250, 250, 250); color: rgb(0, 0, 0);">=C2=A0i</sp=
an><span style=3D"font-family: monospace; background-color: rgb(250, 250, 2=
50); color: rgb(102, 102, 0);">;</span><span style=3D"font-family: monospac=
e; background-color: rgb(250, 250, 250); color: rgb(0, 0, 0);"><br>=C2=A0 =
=C2=A0=C2=A0</span><span style=3D"font-family: monospace; background-color:=
 rgb(250, 250, 250); color: rgb(0, 0, 136);">auto</span><span style=3D"font=
-family: monospace; background-color: rgb(250, 250, 250); color: rgb(0, 0, =
0);">=C2=A0f=C2=A0</span><span style=3D"font-family: monospace; background-=
color: rgb(250, 250, 250); color: rgb(102, 102, 0);">=3D</span><span style=
=3D"font-family: monospace; background-color: rgb(250, 250, 250); color: rg=
b(0, 0, 0);">=C2=A0</span><span style=3D"font-family: monospace; background=
-color: rgb(250, 250, 250); color: rgb(102, 102, 0);">[</span><span style=
=3D"font-family: monospace; background-color: rgb(250, 250, 250); color: rg=
b(0, 0, 0);">i</span><span style=3D"font-family: monospace; background-colo=
r: rgb(250, 250, 250); color: rgb(102, 102, 0);">=3D</span><span style=3D"f=
ont-family: monospace; background-color: rgb(250, 250, 250); color: rgb(0, =
102, 102);">0L</span><span style=3D"font-family: monospace; background-colo=
r: rgb(250, 250, 250); color: rgb(102, 102, 0);">](</span><span style=3D"fo=
nt-family: monospace; background-color: rgb(250, 250, 250); color: rgb(0, 0=
, 136);">char</span><span style=3D"font-family: monospace; background-color=
: rgb(250, 250, 250); color: rgb(0, 0, 0);">=C2=A0i</span><span style=3D"fo=
nt-family: monospace; background-color: rgb(250, 250, 250); color: rgb(102,=
 102, 0);">)</span><span style=3D"font-family: monospace; background-color:=
 rgb(250, 250, 250); color: rgb(0, 0, 0);">=C2=A0</span><span style=3D"font=
-family: monospace; background-color: rgb(250, 250, 250); color: rgb(102, 1=
02, 0);">-&gt;</span><span style=3D"font-family: monospace; background-colo=
r: rgb(250, 250, 250); color: rgb(0, 0, 0);">=C2=A0</span><span style=3D"fo=
nt-family: monospace; background-color: rgb(250, 250, 250); color: rgb(0, 0=
, 136);">decltype</span><span style=3D"font-family: monospace; background-c=
olor: rgb(250, 250, 250); color: rgb(102, 102, 0);">(</span><span style=3D"=
font-family: monospace; background-color: rgb(250, 250, 250); color: rgb(0,=
 0, 0);">i</span><span style=3D"font-family: monospace; background-color: r=
gb(250, 250, 250); color: rgb(102, 102, 0);">)</span><span style=3D"font-fa=
mily: monospace; background-color: rgb(250, 250, 250); color: rgb(0, 0, 0);=
">=C2=A0</span><span style=3D"font-family: monospace; background-color: rgb=
(250, 250, 250); color: rgb(102, 102, 0);">{</span><span style=3D"font-fami=
ly: monospace; background-color: rgb(250, 250, 250); color: rgb(0, 0, 0);">=
=C2=A0</span><span style=3D"font-family: monospace; background-color: rgb(2=
50, 250, 250); color: rgb(0, 0, 136);">return</span><span style=3D"font-fam=
ily: monospace; background-color: rgb(250, 250, 250); color: rgb(0, 0, 0);"=
>=C2=A0</span><span style=3D"font-family: monospace; background-color: rgb(=
250, 250, 250); color: rgb(0, 102, 102);">0</span><span style=3D"font-famil=
y: monospace; background-color: rgb(250, 250, 250); color: rgb(102, 102, 0)=
;">;</span><span style=3D"font-family: monospace; background-color: rgb(250=
, 250, 250); color: rgb(0, 0, 0);">=C2=A0</span><span style=3D"font-family:=
 monospace; background-color: rgb(250, 250, 250); color: rgb(102, 102, 0);"=
>}</span><span style=3D"font-family: monospace; background-color: rgb(250, =
250, 250); color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0=C2=A0</span><span style=
=3D"font-family: monospace; background-color: rgb(250, 250, 250); color: rg=
b(136, 0, 0);">// decltype(f(0)) =3D=3D ???</span><br>is something that the=
 paper should address, after the change in scope. I am not sure where to st=
art here though, as I&#39;m confident that multiple rules from different pa=
rts of the standard come into play here. <br>Intuitively I think that the r=
eturn type should evaluate to `char` (as the parameter `i` is closer to the=
 trailing return type). What do you think? =C2=A0<br><br><br>On Thursday, 1=
5 December 2016 13:27:06 UTC, Vittorio Romeo  wrote:<blockquote class=3D"gm=
ail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc soli=
d;padding-left: 1ex;"><div dir=3D"ltr"><pre class=3D"gmail_quote" style=3D"=
margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-lef=
t:1ex"><code style=3D"font-family:Consolas,Menlo,Monaco,&quot;Lucida Consol=
e&quot;,&quot;Liberation Mono&quot;,&quot;DejaVu Sans Mono&quot;,&quot;Bits=
tream Vera Sans Mono&quot;,&quot;Courier New&quot;,monospace,sans-serif;whi=
te-space:inherit"><span style=3D"color:rgb(43,145,175)">int</span><span sty=
le=3D"color:rgb(48,51,54)"> main</span><span style=3D"color:rgb(48,51,54)">=
()</span><span style=3D"color:rgb(48,51,54)">
</span><span style=3D"color:rgb(48,51,54)">{</span><span style=3D"color:rgb=
(48,51,54)">
    </span><span style=3D"color:rgb(16,16,148)">auto</span><span style=3D"c=
olor:rgb(48,51,54)"> l </span><span style=3D"color:rgb(48,51,54)">=3D</span=
><span style=3D"color:rgb(48,51,54)"> </span><span style=3D"color:rgb(48,51=
,54)">[</span><span style=3D"color:rgb(48,51,54)">x </span><span style=3D"c=
olor:rgb(48,51,54)">=3D</span><span style=3D"color:rgb(48,51,54)"> </span><=
span style=3D"color:rgb(125,39,39)">10</span><span style=3D"color:rgb(48,51=
,54)">]()</span><span style=3D"color:rgb(48,51,54)"> </span><span style=3D"=
color:rgb(48,51,54)">-&gt;</span><span style=3D"color:rgb(48,51,54)"> </spa=
n><span style=3D"color:rgb(16,16,148)">decltype</span><span style=3D"color:=
rgb(48,51,54)">(</span><span style=3D"color:rgb(48,51,54)">x</span><span st=
yle=3D"color:rgb(48,51,54)">)</span><span style=3D"color:rgb(48,51,54)"> </=
span><span style=3D"color:rgb(48,51,54)">{};</span><span style=3D"color:rgb=
(48,51,54)">
</span><span style=3D"color:rgb(48,51,54)">}
</span></code></pre><br><br><ul style=3D"margin:0px 0px 1em 30px;padding:0p=
x;border:0px;font-size:15px;font-family:Arial,&quot;Helvetica Neue&quot;,He=
lvetica,sans-serif;color:rgb(36,39,41)"><li style=3D"margin:0px 0px 0.5em;p=
adding:0px;border:0px;word-wrap:break-word"><p style=3D"clear:both"><a href=
=3D"http://melpon.org/wandbox/permlink/zsFICgiaMhCrIIwe" rel=3D"nofollow" s=
tyle=3D"color:rgb(0,89,153);font-family:Arial,&quot;Helvetica Neue&quot;,He=
lvetica,sans-serif;font-size:15px" target=3D"_blank" onmousedown=3D"this.hr=
ef=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmelpon.org%2Fwandbox%=
2Fpermlink%2FzsFICgiaMhCrIIwe\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH9SWA=
WY4JcXh_a1opBWZW0-WwRMw&#39;;return true;" onclick=3D"this.href=3D&#39;http=
://www.google.com/url?q\x3dhttp%3A%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2Fz=
sFICgiaMhCrIIwe\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH9SWAWY4JcXh_a1opBW=
ZW0-WwRMw&#39;;return true;"><strong style=3D"color:rgb(0,89,153);font-fami=
ly:Arial,&quot;Helvetica Neue&quot;,Helvetica,sans-serif;font-size:15px">cl=
ang++ 4.0</strong><font color=3D"#005999" style=3D"color:rgb(0,89,153);font=
-family:Arial,&quot;Helvetica Neue&quot;,Helvetica,sans-serif;font-size:15p=
x"><span>=C2=A0rejects this code</span></font></a><font color=3D"#242729" f=
ace=3D"Arial, Helvetica Neue, Helvetica, sans-serif"><span style=3D"font-si=
ze:15px">=C2=A0with the following error:</span></font><br></p></li><li styl=
e=3D"margin:0px 0px 0.5em;padding:0px;border:0px;word-wrap:break-word"><pre=
 style=3D"margin-top:0.5em;margin-bottom:1em;padding:5px;font-size:13px;wid=
th:auto;max-height:600px;overflow:auto;font-family:Consolas,Menlo,Monaco,&q=
uot;Lucida Console&quot;,&quot;Liberation Mono&quot;,&quot;DejaVu Sans Mono=
&quot;,&quot;Bitstream Vera Sans Mono&quot;,&quot;Courier New&quot;,monospa=
ce,sans-serif;background-color:rgb(239,240,241);color:rgb(57,51,24);word-wr=
ap:normal"><code style=3D"font-family:Consolas,Menlo,Monaco,&quot;Lucida Co=
nsole&quot;,&quot;Liberation Mono&quot;,&quot;DejaVu Sans Mono&quot;,&quot;=
Bitstream Vera Sans Mono&quot;,&quot;Courier New&quot;,monospace,sans-serif=
;white-space:inherit"><span style=3D"color:rgb(48,51,54)">error</span><span=
 style=3D"color:rgb(48,51,54)">:</span><span style=3D"color:rgb(48,51,54)">=
 use of undeclared identifier </span><span style=3D"color:rgb(125,39,39)">&=
#39;x&#39;</span><span style=3D"color:rgb(48,51,54)">
        </span><span style=3D"color:rgb(16,16,148)">auto</span><span style=
=3D"color:rgb(48,51,54)"> l </span><span style=3D"color:rgb(48,51,54)">=3D<=
/span><span style=3D"color:rgb(48,51,54)"> </span><span style=3D"color:rgb(=
48,51,54)">[</span><span style=3D"color:rgb(48,51,54)">x </span><span style=
=3D"color:rgb(48,51,54)">=3D</span><span style=3D"color:rgb(48,51,54)"> </s=
pan><span style=3D"color:rgb(125,39,39)">10</span><span style=3D"color:rgb(=
48,51,54)">]()</span><span style=3D"color:rgb(48,51,54)"> </span><span styl=
e=3D"color:rgb(48,51,54)">-&gt;</span><span style=3D"color:rgb(48,51,54)"> =
</span><span style=3D"color:rgb(16,16,148)">decltype</span><span style=3D"c=
olor:rgb(48,51,54)">(</span><span style=3D"color:rgb(48,51,54)">x</span><sp=
an style=3D"color:rgb(48,51,54)">)</span><span style=3D"color:rgb(48,51,54)=
"> </span><span style=3D"color:rgb(48,51,54)">{};</span><span style=3D"colo=
r:rgb(48,51,54)">
                                        </span><span style=3D"color:rgb(48,=
51,54)">^</span></code></pre></li><li style=3D"margin:0px;padding:0px;borde=
r:0px;word-wrap:break-word"><p style=3D"clear:both"><a href=3D"http://melpo=
n.org/wandbox/permlink/LXamt4MieU6n77Xs" rel=3D"nofollow" style=3D"color:rg=
b(0,89,153)" target=3D"_blank" onmousedown=3D"this.href=3D&#39;http://www.g=
oogle.com/url?q\x3dhttp%3A%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2FLXamt4Mie=
U6n77Xs\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHSPSY4b2BOHlywp5QOvR96HtQFB=
w&#39;;return true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?=
q\x3dhttp%3A%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2FLXamt4MieU6n77Xs\x26sa\=
x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHSPSY4b2BOHlywp5QOvR96HtQFBw&#39;;return =
true;"><strong>g++ 7</strong>=C2=A0rejects this code</a>=C2=A0with the foll=
owing error:</p><pre style=3D"margin-top:0.5em;margin-bottom:1em;padding:5p=
x;font-size:13px;width:auto;max-height:600px;overflow:auto;font-family:Cons=
olas,Menlo,Monaco,&quot;Lucida Console&quot;,&quot;Liberation Mono&quot;,&q=
uot;DejaVu Sans Mono&quot;,&quot;Bitstream Vera Sans Mono&quot;,&quot;Couri=
er New&quot;,monospace,sans-serif;background-color:rgb(239,240,241);color:r=
gb(57,51,24);word-wrap:normal"><code style=3D"font-family:Consolas,Menlo,Mo=
naco,&quot;Lucida Console&quot;,&quot;Liberation Mono&quot;,&quot;DejaVu Sa=
ns Mono&quot;,&quot;Bitstream Vera Sans Mono&quot;,&quot;Courier New&quot;,=
monospace,sans-serif;white-space:inherit"><span style=3D"color:rgb(43,145,1=
75)">In</span><span style=3D"color:rgb(48,51,54)"> function </span><span st=
yle=3D"color:rgb(125,39,39)">&#39;int main()&#39;</span><span style=3D"colo=
r:rgb(48,51,54)">:</span><span style=3D"color:rgb(48,51,54)">
error</span><span style=3D"color:rgb(48,51,54)">:</span><span style=3D"colo=
r:rgb(48,51,54)"> </span><span style=3D"color:rgb(125,39,39)">&#39;x&#39;</=
span><span style=3D"color:rgb(48,51,54)"> was not declared in </span><span =
style=3D"color:rgb(16,16,148)">this</span><span style=3D"color:rgb(48,51,54=
)"> scope
  </span><span style=3D"color:rgb(16,16,148)">auto</span><span style=3D"col=
or:rgb(48,51,54)"> l </span><span style=3D"color:rgb(48,51,54)">=3D</span><=
span style=3D"color:rgb(48,51,54)"> </span><span style=3D"color:rgb(48,51,5=
4)">[</span><span style=3D"color:rgb(48,51,54)">x </span><span style=3D"col=
or:rgb(48,51,54)">=3D</span><span style=3D"color:rgb(48,51,54)"> </span><sp=
an style=3D"color:rgb(125,39,39)">10</span><span style=3D"color:rgb(48,51,5=
4)">]()</span><span style=3D"color:rgb(48,51,54)"> </span><span style=3D"co=
lor:rgb(48,51,54)">-&gt;</span><span style=3D"color:rgb(48,51,54)"> </span>=
<span style=3D"color:rgb(16,16,148)">decltype</span><span style=3D"color:rg=
b(48,51,54)">(</span><span style=3D"color:rgb(48,51,54)">x</span><span styl=
e=3D"color:rgb(48,51,54)">)</span><span style=3D"color:rgb(48,51,54)"> </sp=
an><span style=3D"color:rgb(48,51,54)">{};</span><span style=3D"color:rgb(4=
8,51,54)">
                                  </span><span style=3D"color:rgb(48,51,54)=
">^</span><span style=3D"color:rgb(48,51,54)">
error</span><span style=3D"color:rgb(48,51,54)">:</span><span style=3D"colo=
r:rgb(48,51,54)"> </span><span style=3D"color:rgb(125,39,39)">&#39;x&#39;</=
span><span style=3D"color:rgb(48,51,54)"> was not declared in </span><span =
style=3D"color:rgb(16,16,148)">this</span><span style=3D"color:rgb(48,51,54=
)"> scope
</span><span style=3D"color:rgb(43,145,175)">In</span><span style=3D"color:=
rgb(48,51,54)"> lambda function</span><span style=3D"color:rgb(48,51,54)">:=
</span><span style=3D"color:rgb(48,51,54)">
warning</span><span style=3D"color:rgb(48,51,54)">:</span><span style=3D"co=
lor:rgb(48,51,54)"> no </span><span style=3D"color:rgb(16,16,148)">return</=
span><span style=3D"color:rgb(48,51,54)"> statement in function returning n=
on</span><span style=3D"color:rgb(48,51,54)">-</span><span style=3D"color:r=
gb(16,16,148)">void</span><span style=3D"color:rgb(48,51,54)"> </span><span=
 style=3D"color:rgb(48,51,54)">[-</span><span style=3D"color:rgb(43,145,175=
)">Wreturn</span><span style=3D"color:rgb(48,51,54)">-</span><span style=3D=
"color:rgb(48,51,54)">type</span><span style=3D"color:rgb(48,51,54)">]</spa=
n><span style=3D"color:rgb(48,51,54)">
  </span><span style=3D"color:rgb(16,16,148)">auto</span><span style=3D"col=
or:rgb(48,51,54)"> l </span><span style=3D"color:rgb(48,51,54)">=3D</span><=
span style=3D"color:rgb(48,51,54)"> </span><span style=3D"color:rgb(48,51,5=
4)">[</span><span style=3D"color:rgb(48,51,54)">x </span><span style=3D"col=
or:rgb(48,51,54)">=3D</span><span style=3D"color:rgb(48,51,54)"> </span><sp=
an style=3D"color:rgb(125,39,39)">10</span><span style=3D"color:rgb(48,51,5=
4)">]()</span><span style=3D"color:rgb(48,51,54)"> </span><span style=3D"co=
lor:rgb(48,51,54)">-&gt;</span><span style=3D"color:rgb(48,51,54)"> </span>=
<span style=3D"color:rgb(16,16,148)">decltype</span><span style=3D"color:rg=
b(48,51,54)">(</span><span style=3D"color:rgb(48,51,54)">x</span><span styl=
e=3D"color:rgb(48,51,54)">)</span><span style=3D"color:rgb(48,51,54)"> </sp=
an><span style=3D"color:rgb(48,51,54)">{};</span><span style=3D"color:rgb(4=
8,51,54)">
                                  </span><span style=3D"color:rgb(48,51,54)=
">^</span></code></pre><br></li></ul><font color=3D"#303336" face=3D"Consol=
as, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitst=
ream Vera Sans Mono, Courier New, monospace, sans-serif"><span style=3D"whi=
te-space:pre">I posted this today on StackOverflow thinking it was a compil=
er bug:</span></font><div><font color=3D"#303336" face=3D"Consolas, Menlo, =
Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera S=
ans Mono, Courier New, monospace, sans-serif"><span style=3D"white-space:pr=
e"><a href=3D"http://stackoverflow.com/questions/41162200/" target=3D"_blan=
k" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.google.com/u=
rl?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F41162200%2F\x26sa\x3dD=
\x26sntz\x3d1\x26usg\x3dAFQjCNHh5TH7No6BzVZwtlQGB-vFYN7FSw&#39;;return true=
;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F=
stackoverflow.com%2Fquestions%2F41162200%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\=
x3dAFQjCNHh5TH7No6BzVZwtlQGB-vFYN7FSw&#39;;return true;">http://stackoverfl=
ow.com/<wbr>questions/41162200/</a></span><br></font></div><div><font color=
=3D"#303336" face=3D"Consolas, Menlo, Monaco, Lucida Console, Liberation Mo=
no, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, san=
s-serif"><span style=3D"white-space:pre"><br></span></font></div><div><font=
 color=3D"#303336" face=3D"Consolas, Menlo, Monaco, Lucida Console, Liberat=
ion Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospac=
e, sans-serif"><span style=3D"white-space:pre">But it&#39;s not - the stand=
ard says that the scope of `x` is limited to the body of the lambda. This a=
nswer has the details:</span>
</font></div><div><font color=3D"#303336" face=3D"Consolas, Menlo, Monaco, =
Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono=
, Courier New, monospace, sans-serif"><span style=3D"white-space:pre"><a hr=
ef=3D"http://stackoverflow.com/a/41162972/598696" target=3D"_blank" rel=3D"=
nofollow" onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\x3dht=
tp%3A%2F%2Fstackoverflow.com%2Fa%2F41162972%2F598696\x26sa\x3dD\x26sntz\x3d=
1\x26usg\x3dAFQjCNEkofXkcuUbDPfQ57qIz4z2p7fgKQ&#39;;return true;" onclick=
=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverf=
low.com%2Fa%2F41162972%2F598696\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEko=
fXkcuUbDPfQ57qIz4z2p7fgKQ&#39;;return true;">http://stackoverflow.com/a/<wb=
r>41162972/598696</a></span><br></font></div><div><font color=3D"#303336" f=
ace=3D"Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu San=
s Mono, Bitstream Vera Sans Mono, Courier New, monospace, sans-serif"><span=
 style=3D"white-space:pre">(quoted below)</span></font></div><div><font col=
or=3D"#303336" face=3D"Consolas, Menlo, Monaco, Lucida Console, Liberation =
Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, s=
ans-serif"><span style=3D"white-space:pre"><br></span></font></div><div><fo=
nt color=3D"#303336" face=3D"Consolas, Menlo, Monaco, Lucida Console, Liber=
ation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monosp=
ace, sans-serif"><span style=3D"white-space:pre">---</span></font></div><di=
v><font color=3D"#303336" face=3D"Consolas, Menlo, Monaco, Lucida Console, =
Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, m=
onospace, sans-serif"><span style=3D"white-space:pre"><br></span></font></d=
iv><div><p style=3D"margin-bottom:1em;font-size:15px;clear:both;color:rgb(3=
6,39,41);font-family:Arial,&quot;Helvetica Neue&quot;,Helvetica,sans-serif"=
><strong>TL;DR</strong>: Compilers behave as expected.</p><p style=3D"margi=
n-bottom:1em;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Aria=
l,&quot;Helvetica Neue&quot;,Helvetica,sans-serif">The standard defines lam=
bda semantics as follows [expr.prim.lambda, section 1]:</p><blockquote styl=
e=3D"margin:0px 0px 10px;padding:10px;border-width:0px 0px 0px 2px;border-t=
op-style:initial;border-right-style:initial;border-bottom-style:initial;bor=
der-left-style:solid;border-top-color:initial;border-right-color:initial;bo=
rder-bottom-color:initial;border-left-color:rgb(255,235,142);font-size:15px=
;quotes:none;background-color:rgb(255,248,220);color:rgb(36,39,41);font-fam=
ily:Arial,&quot;Helvetica Neue&quot;,Helvetica,sans-serif"><p style=3D"marg=
in-bottom:1em;clear:both">lambda-expression:</p><pre style=3D"padding:5px;f=
ont-size:13px;width:auto;max-height:600px;overflow:auto;font-family:Consola=
s,Menlo,Monaco,&quot;Lucida Console&quot;,&quot;Liberation Mono&quot;,&quot=
;DejaVu Sans Mono&quot;,&quot;Bitstream Vera Sans Mono&quot;,&quot;Courier =
New&quot;,monospace,sans-serif;background-color:rgb(239,240,241);color:rgb(=
57,51,24);word-wrap:normal"><code style=3D"font-family:Consolas,Menlo,Monac=
o,&quot;Lucida Console&quot;,&quot;Liberation Mono&quot;,&quot;DejaVu Sans =
Mono&quot;,&quot;Bitstream Vera Sans Mono&quot;,&quot;Courier New&quot;,mon=
ospace,sans-serif;white-space:inherit"><span style=3D"color:rgb(48,51,54)">=
   lambda</span><span style=3D"color:rgb(48,51,54)">-</span><span style=3D"=
color:rgb(48,51,54)">introducer lambda</span><span style=3D"color:rgb(48,51=
,54)">-</span><span style=3D"color:rgb(48,51,54)">declarator_opt compound</=
span><span style=3D"color:rgb(48,51,54)">-</span><span style=3D"color:rgb(4=
8,51,54)">statement</span></code></pre></blockquote><p style=3D"margin-bott=
om:1em;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial,&quo=
t;Helvetica Neue&quot;,Helvetica,sans-serif">Here=C2=A0<em>compound-stateme=
nt</em>=C2=A0is just the body of lambda between {}, because everything else=
 is included in=C2=A0<em>lambda-declarator</em>:</p><blockquote style=3D"ma=
rgin:0px 0px 10px;padding:10px;border-width:0px 0px 0px 2px;border-top-styl=
e:initial;border-right-style:initial;border-bottom-style:initial;border-lef=
t-style:solid;border-top-color:initial;border-right-color:initial;border-bo=
ttom-color:initial;border-left-color:rgb(255,235,142);font-size:15px;quotes=
:none;background-color:rgb(255,248,220);color:rgb(36,39,41);font-family:Ari=
al,&quot;Helvetica Neue&quot;,Helvetica,sans-serif"><p style=3D"margin-bott=
om:1em;clear:both">lambda-declarator:</p><pre style=3D"padding:5px;font-siz=
e:13px;width:auto;max-height:600px;overflow:auto;font-family:Consolas,Menlo=
,Monaco,&quot;Lucida Console&quot;,&quot;Liberation Mono&quot;,&quot;DejaVu=
 Sans Mono&quot;,&quot;Bitstream Vera Sans Mono&quot;,&quot;Courier New&quo=
t;,monospace,sans-serif;background-color:rgb(239,240,241);color:rgb(57,51,2=
4);word-wrap:normal"><code style=3D"font-family:Consolas,Menlo,Monaco,&quot=
;Lucida Console&quot;,&quot;Liberation Mono&quot;,&quot;DejaVu Sans Mono&qu=
ot;,&quot;Bitstream Vera Sans Mono&quot;,&quot;Courier New&quot;,monospace,=
sans-serif;white-space:inherit"><span style=3D"color:rgb(48,51,54)">   </sp=
an><span style=3D"color:rgb(48,51,54)">(</span><span style=3D"color:rgb(48,=
51,54)"> parameter</span><span style=3D"color:rgb(48,51,54)">-</span><span =
style=3D"color:rgb(48,51,54)">declaration</span><span style=3D"color:rgb(48=
,51,54)">-</span><span style=3D"color:rgb(48,51,54)">clause </span><span st=
yle=3D"color:rgb(48,51,54)">)</span><span style=3D"color:rgb(48,51,54)"> de=
cl</span><span style=3D"color:rgb(48,51,54)">-</span><span style=3D"color:r=
gb(48,51,54)">specifier</span><span style=3D"color:rgb(48,51,54)">-</span><=
span style=3D"color:rgb(48,51,54)">seq_opt
       exception</span><span style=3D"color:rgb(48,51,54)">-</span><span st=
yle=3D"color:rgb(48,51,54)">specification_opt attribute</span><span style=
=3D"color:rgb(48,51,54)">-</span><span style=3D"color:rgb(48,51,54)">specif=
ier</span><span style=3D"color:rgb(48,51,54)">-</span><span style=3D"color:=
rgb(48,51,54)">seq_opt trailing</span><span style=3D"color:rgb(48,51,54)">-=
</span><span style=3D"color:rgb(16,16,148)">return</span><span style=3D"col=
or:rgb(48,51,54)">-</span><span style=3D"color:rgb(48,51,54)">type_opt</spa=
n></code></pre></blockquote><p style=3D"margin-bottom:1em;font-size:15px;cl=
ear:both;color:rgb(36,39,41);font-family:Arial,&quot;Helvetica Neue&quot;,H=
elvetica,sans-serif">Also, in section 12 of the same chapter, it&#39;s said=
 that</p><blockquote style=3D"margin:0px 0px 10px;padding:10px;border-width=
:0px 0px 0px 2px;border-top-style:initial;border-right-style:initial;border=
-bottom-style:initial;border-left-style:solid;border-top-color:initial;bord=
er-right-color:initial;border-bottom-color:initial;border-left-color:rgb(25=
5,235,142);font-size:15px;quotes:none;background-color:rgb(255,248,220);col=
or:rgb(36,39,41);font-family:Arial,&quot;Helvetica Neue&quot;,Helvetica,san=
s-serif"><p style=3D"margin-bottom:1em;clear:both">An init-capture behaves =
as if it declares and explicitly captures a variable of the form =E2=80=9Ca=
uto init-capture ;=E2=80=9D whose declarative region is the lambda-expressi=
on=E2=80=99s compound-statement, except that:</p><p style=3D"margin-bottom:=
1em;clear:both">(12.1) =E2=80=94 if the capture is by copy (see below), the=
 non-static data member declared for the capture and the variable are treat=
ed as two different ways of referring to the same object, which has the lif=
etime of the non-static data member, and no additional copy and destruction=
 is performed, and</p><p style=3D"clear:both">(12.2) =E2=80=94 if the captu=
re is by reference, the variable=E2=80=99s lifetime ends when the closure o=
bject=E2=80=99s lifetime ends.</p></blockquote><p style=3D"margin-bottom:1e=
m;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial,&quot;Hel=
vetica Neue&quot;,Helvetica,sans-serif">So, in your first example, variable=
=C2=A0<code style=3D"padding:1px 5px;font-size:13px;font-family:Consolas,Me=
nlo,Monaco,&quot;Lucida Console&quot;,&quot;Liberation Mono&quot;,&quot;Dej=
aVu Sans Mono&quot;,&quot;Bitstream Vera Sans Mono&quot;,&quot;Courier New&=
quot;,monospace,sans-serif;background-color:rgb(239,240,241);white-space:pr=
e-wrap">x</code>=C2=A0scope is the lambda body only, not including the=C2=
=A0<code style=3D"padding:1px 5px;font-size:13px;font-family:Consolas,Menlo=
,Monaco,&quot;Lucida Console&quot;,&quot;Liberation Mono&quot;,&quot;DejaVu=
 Sans Mono&quot;,&quot;Bitstream Vera Sans Mono&quot;,&quot;Courier New&quo=
t;,monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-w=
rap">decltype</code>expression. In the second example, obviously,=C2=A0<cod=
e style=3D"padding:1px 5px;font-size:13px;font-family:Consolas,Menlo,Monaco=
,&quot;Lucida Console&quot;,&quot;Liberation Mono&quot;,&quot;DejaVu Sans M=
ono&quot;,&quot;Bitstream Vera Sans Mono&quot;,&quot;Courier New&quot;,mono=
space,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap">x<=
/code>=C2=A0scope is the function=C2=A0<code style=3D"padding:1px 5px;font-=
size:13px;font-family:Consolas,Menlo,Monaco,&quot;Lucida Console&quot;,&quo=
t;Liberation Mono&quot;,&quot;DejaVu Sans Mono&quot;,&quot;Bitstream Vera S=
ans Mono&quot;,&quot;Courier New&quot;,monospace,sans-serif;background-colo=
r:rgb(239,240,241);white-space:pre-wrap">main</code>.</p><p style=3D"margin=
-bottom:1em;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial=
,&quot;Helvetica Neue&quot;,Helvetica,sans-serif">---</p><p style=3D"margin=
-bottom:1em;font-size:15px;clear:both;color:rgb(36,39,41);font-family:Arial=
,&quot;Helvetica Neue&quot;,Helvetica,sans-serif">Do you think that writing=
 a proposal to relax these rules and to explicitly allow generalized captur=
es to be used inside the trailing return type would be worthwhile?</p><p st=
yle=3D"margin-bottom:1em;font-size:15px;clear:both;color:rgb(36,39,41);font=
-family:Arial,&quot;Helvetica Neue&quot;,Helvetica,sans-serif">One possible=
 use case is when the generalized captures are initialized with complex exp=
ressions. I encountered this while experimenting today (<a href=3D"http://m=
elpon.org/wandbox/permlink/aVasfHaK6boC6NZt" target=3D"_blank" rel=3D"nofol=
low" onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A=
%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2FaVasfHaK6boC6NZt\x26sa\x3dD\x26sntz=
\x3d1\x26usg\x3dAFQjCNEN9UL7N_EUam7yz8sx7tVoHRW3xA&#39;;return true;" oncli=
ck=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmelpon.o=
rg%2Fwandbox%2Fpermlink%2FaVasfHaK6boC6NZt\x26sa\x3dD\x26sntz\x3d1\x26usg\x=
3dAFQjCNEN9UL7N_EUam7yz8sx7tVoHRW3xA&#39;;return true;">http://melpon.org/w=
andbox/<wbr>permlink/aVasfHaK6boC6NZt</a>).<br>In general, it would be bene=
ficial to have this feature whenever the generalized capture is used as par=
t of the return expression in the lambda body.</p></div></div></blockquote>=
</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/cba1a1fa-d3c8-43e0-a1b5-f69fb285a680%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/cba1a1fa-d3c8-43e0-a1b5-f69fb285a680=
%40isocpp.org</a>.<br />

------=_Part_780_1476758788.1481987670362--

------=_Part_779_216450449.1481987670360--

.
