Topic: Propsal(s): Capture List Type Aliases and


Author: "T. C." <rs2740@gmail.com>
Date: Sun, 30 Oct 2016 12:30:35 -0700 (PDT)
Raw View
------=_Part_1006_742946495.1477855835758
Content-Type: multipart/alternative;
 boundary="----=_Part_1007_1944819816.1477855835758"

------=_Part_1007_1944819816.1477855835758
Content-Type: text/plain; charset=UTF-8



On Sunday, October 30, 2016 at 9:09:49 AM UTC-4, Adi Shavit wrote:
>
>
> Unfortunately, the rules for type name lookup are different from the rules
> for variable name lookup for decltype and since payload is not captured
> it will not found and thus using payload_type = decltype(payload); cannot
> be written *inside* the lambda.
>
> Basically, today, the type of payload needs to be wrapped in a named type
> before it can pierce the capture-less lambda without being explicitly
> captured.
>
>
This is incorrect. Complain to Microsoft if you are using MSVC, but the
standard already allows this:

void f(int i) {
    [] { decltype(i) j = 0; }();
}

--
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 email 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/3608a7c3-e535-4f2a-94cc-dc7ad7a0295d%40isocpp.org.

------=_Part_1007_1944819816.1477855835758
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Sunday, October 30, 2016 at 9:09:49 AM UTC-4, A=
di Shavit wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin=
-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"lt=
r"><br><div><div>Unfortunately, the rules for type name lookup are differen=
t from the rules for variable name lookup for <font face=3D"monospace, mono=
space">decltype</font> and since=C2=A0<span style=3D"font-family:monospace,=
monospace">payload</span>=C2=A0is not captured it will not found and thus=
=C2=A0<span style=3D"font-family:monospace,monospace">using payload_type =
=3D decltype(payload); </span>cannot be written <i>inside</i>=C2=A0the lamb=
da.</div></div><div><br></div><div>Basically, today, the type of=C2=A0<span=
 style=3D"font-family:monospace,monospace">payload</span>=C2=A0needs to be =
wrapped in a named type before it can pierce the capture-less lambda withou=
t being explicitly captured.</div><div><br></div></div></blockquote><div><b=
r></div><div>This is incorrect. Complain to Microsoft if you are using MSVC=
, but the standard already allows this:</div><div><br></div><div><div>void =
f(int i) {</div><div>=C2=A0 =C2=A0 [] { decltype(i) j =3D 0; }();</div><div=
>}</div></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/3608a7c3-e535-4f2a-94cc-dc7ad7a0295d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/3608a7c3-e535-4f2a-94cc-dc7ad7a0295d=
%40isocpp.org</a>.<br />

------=_Part_1007_1944819816.1477855835758--

------=_Part_1006_742946495.1477855835758--

.


Author: Adi Shavit <adishavit@gmail.com>
Date: Sun, 30 Oct 2016 23:37:37 -0700 (PDT)
Raw View
------=_Part_1535_261796740.1477895857536
Content-Type: multipart/alternative;
 boundary="----=_Part_1536_486737421.1477895857537"

------=_Part_1536_486737421.1477895857537
Content-Type: text/plain; charset=UTF-8


On Sunday, October 30, 2016 at 9:30:35 PM UTC+2, T. C. wrote:
>
>
> This is incorrect. Complain to Microsoft if you are using MSVC, but the
> standard already allows this:
>
> void f(int i) {
>     [] { decltype(i) j = 0; }();
> }
>

Cool, I guess it *was* a compiler issue. I'll write them :-)
Similarly, turns out that statics are also visible
<http://melpon.org/wandbox/permlink/0TJahg1tRfjzp85s>.

Regardless, I still believe that extending the extending function-pointer
conversions is worth considering for constexpr values too.
This can be done today <http://melpon.org/wandbox/permlink/wyAFyzYcRUKL2dnE>
by injecting the constexpr via a type, but that seems convoluted.

Either they should be visible like statics or they could be accepted via
the capture list without affecting conversion to fn.ptr.

Thoughts?







--
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 email 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/3391c499-3e03-4744-b535-48920de463d0%40isocpp.org.

------=_Part_1536_486737421.1477895857537
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><br></div><div>On Sunday, October 30, 2016 at 9:30:35=
 PM UTC+2, T. C. wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div di=
r=3D"ltr"><div><br></div><div>This is incorrect. Complain to Microsoft if y=
ou are using MSVC, but the standard already allows this:</div><div><br></di=
v><div><div>void f(int i) {</div><div>=C2=A0 =C2=A0 [] { decltype(i) j =3D =
0; }();</div><div>}</div></div></div></blockquote><div><br></div><div>Cool,=
 I guess it <i>was</i> a compiler issue. I&#39;ll write them :-)<br></div><=
div>Similarly, <a href=3D"http://melpon.org/wandbox/permlink/0TJahg1tRfjzp8=
5s">turns out that statics are also visible</a>.=C2=A0</div><div><br></div>=
<div>Regardless, I still believe that extending the extending function-poin=
ter conversions is worth considering for constexpr values too.</div><div>Th=
is <a href=3D"http://melpon.org/wandbox/permlink/wyAFyzYcRUKL2dnE">can be d=
one today</a> by injecting the constexpr via a type, but that seems convolu=
ted.</div><div><br></div><div>Either they should be visible like statics or=
 they could be accepted via the capture list without affecting conversion t=
o fn.ptr.</div><div><br></div><div>Thoughts?</div><div><br></div><div><br><=
/div><div><br></div><div><br></div><div><br></div><div>=C2=A0</div></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/3391c499-3e03-4744-b535-48920de463d0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/3391c499-3e03-4744-b535-48920de463d0=
%40isocpp.org</a>.<br />

------=_Part_1536_486737421.1477895857537--

------=_Part_1535_261796740.1477895857536--

.


Author: "T. C." <rs2740@gmail.com>
Date: Sun, 30 Oct 2016 23:48:55 -0700 (PDT)
Raw View
------=_Part_1125_1104709229.1477896535386
Content-Type: multipart/alternative;
 boundary="----=_Part_1126_426629155.1477896535387"

------=_Part_1126_426629155.1477896535387
Content-Type: text/plain; charset=UTF-8



On Monday, October 31, 2016 at 2:37:37 AM UTC-4, Adi Shavit wrote:
>
>
> On Sunday, October 30, 2016 at 9:30:35 PM UTC+2, T. C. wrote:
>>
>>
>> This is incorrect. Complain to Microsoft if you are using MSVC, but the
>> standard already allows this:
>>
>> void f(int i) {
>>     [] { decltype(i) j = 0; }();
>> }
>>
>
> Cool, I guess it *was* a compiler issue. I'll write them :-)
> Similarly, turns out that statics are also visible
> <http://melpon.org/wandbox/permlink/0TJahg1tRfjzp85s>.
>
> Regardless, I still believe that extending the extending function-pointer
> conversions is worth considering for constexpr values too.
> This can be done today
> <http://melpon.org/wandbox/permlink/wyAFyzYcRUKL2dnE> by injecting the
> constexpr via a type, but that seems convoluted.
>
> Either they should be visible like statics or they could be accepted via
> the capture list without affecting conversion to fn.ptr.
>
> Thoughts?
>
>
>
There's no need for capture either if it isn't odr-used:

void f1(int);
void f2(const int&);

void g() {
    constexpr int i = 1;
    [] { f1(i); return i; };  // OK - doesn't odr-use i
    [] { f2(i); };  // error - reference binding odr-uses i
}

--
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 email 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/8d4ec037-ffb6-41e6-a137-fdfc462487e4%40isocpp.org.

------=_Part_1126_426629155.1477896535387
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Monday, October 31, 2016 at 2:37:37 AM UTC-4, A=
di Shavit wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin=
-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"lt=
r"><div><br></div><div>On Sunday, October 30, 2016 at 9:30:35 PM UTC+2, T. =
C. wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.=
8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><br>=
</div><div>This is incorrect. Complain to Microsoft if you are using MSVC, =
but the standard already allows this:</div><div><br></div><div><div>void f(=
int i) {</div><div>=C2=A0 =C2=A0 [] { decltype(i) j =3D 0; }();</div><div>}=
</div></div></div></blockquote><div><br></div><div>Cool, I guess it <i>was<=
/i> a compiler issue. I&#39;ll write them :-)<br></div><div>Similarly, <a h=
ref=3D"http://melpon.org/wandbox/permlink/0TJahg1tRfjzp85s" target=3D"_blan=
k" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.google.com/u=
rl?q\x3dhttp%3A%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2F0TJahg1tRfjzp85s\x26=
sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGqUL1lIHJFjUNrqGBLNuP7I3Aj1g&#39;;retu=
rn true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3=
A%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2F0TJahg1tRfjzp85s\x26sa\x3dD\x26snt=
z\x3d1\x26usg\x3dAFQjCNGqUL1lIHJFjUNrqGBLNuP7I3Aj1g&#39;;return true;">turn=
s out that statics are also visible</a>.=C2=A0</div><div><br></div><div>Reg=
ardless, I still believe that extending the extending function-pointer conv=
ersions is worth considering for constexpr values too.</div><div>This <a hr=
ef=3D"http://melpon.org/wandbox/permlink/wyAFyzYcRUKL2dnE" target=3D"_blank=
" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.google.com/ur=
l?q\x3dhttp%3A%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2FwyAFyzYcRUKL2dnE\x26s=
a\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGpP8cPbqTHWh6j4TUlQzgipEYu8g&#39;;retur=
n true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A=
%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2FwyAFyzYcRUKL2dnE\x26sa\x3dD\x26sntz=
\x3d1\x26usg\x3dAFQjCNGpP8cPbqTHWh6j4TUlQzgipEYu8g&#39;;return true;">can b=
e done today</a> by injecting the constexpr via a type, but that seems conv=
oluted.</div><div><br></div><div>Either they should be visible like statics=
 or they could be accepted via the capture list without affecting conversio=
n to fn.ptr.</div><div><br></div><div>Thoughts?</div><div><br></div><div><b=
r></div></div></div></blockquote><div><br></div><div>There&#39;s no need fo=
r capture either if it isn&#39;t odr-used:</div><div><br></div><div class=
=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-colo=
r: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: b=
reak-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> f1</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">int</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">void</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> f2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">const</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&amp;);</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> g</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">()</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">constexpr</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">int<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> i </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #066;" class=3D"styled-by-prettify">1</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">[]</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> f1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">i</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">return</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> i</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> =C2=A0</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//=
 OK - doesn&#39;t odr-use i</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">[]</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
f2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">i</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> =C2=A0</span><span style=3D"color: #800;" class=3D=
"styled-by-prettify">// error - reference binding odr-uses i</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">}</span></div></code></div><div=
><br></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/8d4ec037-ffb6-41e6-a137-fdfc462487e4%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8d4ec037-ffb6-41e6-a137-fdfc462487e4=
%40isocpp.org</a>.<br />

------=_Part_1126_426629155.1477896535387--

------=_Part_1125_1104709229.1477896535386--

.


Author: Adi Shavit <adishavit@gmail.com>
Date: Mon, 31 Oct 2016 01:59:38 -0700 (PDT)
Raw View
------=_Part_104_809807330.1477904378880
Content-Type: multipart/alternative;
 boundary="----=_Part_105_1455709888.1477904378881"

------=_Part_105_1455709888.1477904378881
Content-Type: text/plain; charset=UTF-8


>
>
> There's no need for capture either if it isn't odr-used:
>
> void f1(int);
> void f2(const int&);
>
> void g() {
>     constexpr int i = 1;
>     [] { f1(i); return i; };  // OK - doesn't odr-use i
>     [] { f2(i); };  // error - reference binding odr-uses i
> }
>
>
Fabulous, again, MSVC does not allow this but other compilers accept both
options (and more <http://coliru.stacked-crooked.com/a/1340316d28e70e27>).
Thanks for illuminating this :-).

Where in the standard can I find the list of things that are implicitly
captured?


--
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 email 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/f10c3f79-59ae-491e-8769-1f139deb9079%40isocpp.org.

------=_Part_105_1455709888.1477904378881
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bor=
der-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><br></di=
v><div>There&#39;s no need for capture either if it isn&#39;t odr-used:</di=
v><div><br></div><div style=3D"background-color:rgb(250,250,250);border-col=
or:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-wor=
d"><code><div><span style=3D"color:#008">void</span><span style=3D"color:#0=
00"> f1</span><span style=3D"color:#660">(</span><span style=3D"color:#008"=
>int</span><span style=3D"color:#660">);</span><span style=3D"color:#000"><=
br></span><span style=3D"color:#008">void</span><span style=3D"color:#000">=
 f2</span><span style=3D"color:#660">(</span><span style=3D"color:#008">con=
st</span><span style=3D"color:#000"> </span><span style=3D"color:#008">int<=
/span><span style=3D"color:#660">&amp;);</span><span style=3D"color:#000"><=
br><br></span><span style=3D"color:#008">void</span><span style=3D"color:#0=
00"> g</span><span style=3D"color:#660">()</span><span style=3D"color:#000"=
> </span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#008">constexpr</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">int</span><span style=3D=
"color:#000"> i </span><span style=3D"color:#660">=3D</span><span style=3D"=
color:#000"> </span><span style=3D"color:#066">1</span><span style=3D"color=
:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span st=
yle=3D"color:#660">[]</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"> f1</span><span style=3D=
"color:#660">(</span><span style=3D"color:#000">i</span><span style=3D"colo=
r:#660">);</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
08">return</span><span style=3D"color:#000"> i</span><span style=3D"color:#=
660">;</span><span style=3D"color:#000"> </span><span style=3D"color:#660">=
};</span><span style=3D"color:#000"> =C2=A0</span><span style=3D"color:#800=
">// OK - doesn&#39;t odr-use i</span><span style=3D"color:#000"><br>=C2=A0=
 =C2=A0 </span><span style=3D"color:#660">[]</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#660">{</span><span style=3D"color:#000"> f=
2</span><span style=3D"color:#660">(</span><span style=3D"color:#000">i</sp=
an><span style=3D"color:#660">);</span><span style=3D"color:#000"> </span><=
span style=3D"color:#660">};</span><span style=3D"color:#000"> =C2=A0</span=
><span style=3D"color:#800">// error - reference binding odr-uses i</span><=
span style=3D"color:#000"><br></span><span style=3D"color:#660">}</span></d=
iv></code></div><div><br></div></div></blockquote><div><br></div><div>Fabul=
ous, again, MSVC does not allow this but other compilers accept both option=
s (and <a href=3D"http://coliru.stacked-crooked.com/a/1340316d28e70e27">mor=
e</a>).</div><div>Thanks for illuminating this :-).</div><div><br></div><di=
v>Where in the standard can I find the list of things that are implicitly c=
aptured?</div><div>=C2=A0</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/f10c3f79-59ae-491e-8769-1f139deb9079%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f10c3f79-59ae-491e-8769-1f139deb9079=
%40isocpp.org</a>.<br />

------=_Part_105_1455709888.1477904378881--

------=_Part_104_809807330.1477904378880--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 31 Oct 2016 06:27:05 -0700 (PDT)
Raw View
------=_Part_1886_544470029.1477920425644
Content-Type: multipart/alternative;
 boundary="----=_Part_1887_1724456106.1477920425644"

------=_Part_1887_1724456106.1477920425644
Content-Type: text/plain; charset=UTF-8



On Monday, October 31, 2016 at 4:59:38 AM UTC-4, Adi Shavit wrote:
>
>
>> There's no need for capture either if it isn't odr-used:
>>
>> void f1(int);
>> void f2(const int&);
>>
>> void g() {
>>     constexpr int i = 1;
>>     [] { f1(i); return i; };  // OK - doesn't odr-use i
>>     [] { f2(i); };  // error - reference binding odr-uses i
>> }
>>
>>
> Fabulous, again, MSVC does not allow this but other compilers accept both
> options (and more <http://coliru.stacked-crooked.com/a/1340316d28e70e27>).
> Thanks for illuminating this :-).
>
> Where in the standard can I find the list of things that are implicitly
> captured?
>

The point is that they're not captured at all. The only things that can be
captured are those things which are ODR-used. So you have to look up the
rules on ODR use.

--
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 email 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/179882ff-1637-4c2e-b8cf-2b1c405cf351%40isocpp.org.

------=_Part_1887_1724456106.1477920425644
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Monday, October 31, 2016 at 4:59:38 AM UTC-4, A=
di Shavit wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin=
-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #cc=
c solid;padding-left:1ex"><div dir=3D"ltr"><div><br></div><div>There&#39;s =
no need for capture either if it isn&#39;t odr-used:</div><div><br></div><d=
iv style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187)=
;border-style:solid;border-width:1px;word-wrap:break-word"><code><div><span=
 style=3D"color:#008">void</span><span style=3D"color:#000"> f1</span><span=
 style=3D"color:#660">(</span><span style=3D"color:#008">int</span><span st=
yle=3D"color:#660">);</span><span style=3D"color:#000"><br></span><span sty=
le=3D"color:#008">void</span><span style=3D"color:#000"> f2</span><span sty=
le=3D"color:#660">(</span><span style=3D"color:#008">const</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#008">int</span><span style=
=3D"color:#660">&amp;);</span><span style=3D"color:#000"><br><br></span><sp=
an style=3D"color:#008">void</span><span style=3D"color:#000"> g</span><spa=
n style=3D"color:#660">()</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color:#008">constexpr</span><span style=3D"color:#000"> =
</span><span style=3D"color:#008">int</span><span style=3D"color:#000"> i <=
/span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#066">1</span><span style=3D"color:#660">;</span><s=
pan style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660=
">[]</span><span style=3D"color:#000"> </span><span style=3D"color:#660">{<=
/span><span style=3D"color:#000"> f1</span><span style=3D"color:#660">(</sp=
an><span style=3D"color:#000">i</span><span style=3D"color:#660">);</span><=
span style=3D"color:#000"> </span><span style=3D"color:#008">return</span><=
span style=3D"color:#000"> i</span><span style=3D"color:#660">;</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#660">};</span><span sty=
le=3D"color:#000"> =C2=A0</span><span style=3D"color:#800">// OK - doesn&#3=
9;t odr-use i</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><sp=
an style=3D"color:#660">[]</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#660">{</span><span style=3D"color:#000"> f2</span><span styl=
e=3D"color:#660">(</span><span style=3D"color:#000">i</span><span style=3D"=
color:#660">);</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#660">};</span><span style=3D"color:#000"> =C2=A0</span><span style=3D"co=
lor:#800">// error - reference binding odr-uses i</span><span style=3D"colo=
r:#000"><br></span><span style=3D"color:#660">}</span></div></code></div><d=
iv><br></div></div></blockquote><div><br></div><div>Fabulous, again, MSVC d=
oes not allow this but other compilers accept both options (and <a href=3D"=
http://coliru.stacked-crooked.com/a/1340316d28e70e27" target=3D"_blank" rel=
=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\x=
3dhttp%3A%2F%2Fcoliru.stacked-crooked.com%2Fa%2F1340316d28e70e27\x26sa\x3dD=
\x26sntz\x3d1\x26usg\x3dAFQjCNGdJUlu19x29FXT-8jV75YHBSt3nA&#39;;return true=
;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F=
coliru.stacked-crooked.com%2Fa%2F1340316d28e70e27\x26sa\x3dD\x26sntz\x3d1\x=
26usg\x3dAFQjCNGdJUlu19x29FXT-8jV75YHBSt3nA&#39;;return true;">more</a>).</=
div><div>Thanks for illuminating this :-).</div><div><br></div><div>Where i=
n the standard can I find the list of things that are implicitly captured?<=
/div></blockquote><div><br>The point is that they&#39;re not captured at al=
l. The only things that can be captured are those things which are ODR-used=
.. So you have to look up the rules on ODR use. <br></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/179882ff-1637-4c2e-b8cf-2b1c405cf351%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/179882ff-1637-4c2e-b8cf-2b1c405cf351=
%40isocpp.org</a>.<br />

------=_Part_1887_1724456106.1477920425644--

------=_Part_1886_544470029.1477920425644--

.


Author: Adi Shavit <adishavit@gmail.com>
Date: Mon, 31 Oct 2016 06:30:08 -0700 (PDT)
Raw View
------=_Part_1122_1499391766.1477920608770
Content-Type: multipart/alternative;
 boundary="----=_Part_1123_1564655377.1477920608770"

------=_Part_1123_1564655377.1477920608770
Content-Type: text/plain; charset=UTF-8


>
> The point is that they're not captured at all. The only things that can be
> captured are those things which are ODR-used. So you have to look up the
> rules on ODR use.
>

Thank you.
I think I found it <http://eel.is/c++draft/basic.def.odr>.

   - http://eel.is/c++draft/expr.prim.lambda
   - http://eel.is/c++draft/basic.def.odr


--
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 email 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/6dcb059d-599e-4860-96c9-2ce85a9c52c8%40isocpp.org.

------=_Part_1123_1564655377.1477920608770
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><div>The point is that they&#39;re not captured at all. The only things=
 that can be captured are those things which are ODR-used. So you have to l=
ook up the rules on ODR use. <br></div></div></blockquote><div><br></div><d=
iv>Thank you.=C2=A0</div><div>I think I <a href=3D"http://eel.is/c++draft/b=
asic.def.odr">found it</a>.</div><div><ul><li><span><a class=3D"linkclass" =
href=3D"http://eel.is/c++draft/expr.prim.lambda">http://eel.is/c++draft/exp=
r.prim.lambda</a></span><br></li><li><span><a class=3D"linkclass" href=3D"h=
ttp://eel.is/c++draft/basic.def.odr">http://eel.is/c++draft/basic.def.odr</=
a></span><br></li></ul></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/6dcb059d-599e-4860-96c9-2ce85a9c52c8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/6dcb059d-599e-4860-96c9-2ce85a9c52c8=
%40isocpp.org</a>.<br />

------=_Part_1123_1564655377.1477920608770--

------=_Part_1122_1499391766.1477920608770--

.