* [Bug c++/64791] Generic lambda fails to implicitly capture `const` variable
2015-01-25 21:33 [Bug c++/64791] New: Generic lambda fails to implicitly capture `const` variable tom at kera dot name
@ 2015-01-25 21:36 ` tom at kera dot name
2015-01-25 22:14 ` tom at kera dot name
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tom at kera dot name @ 2015-01-25 21:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64791
--- Comment #1 from Tomalak Geret'kal <tom at kera dot name> ---
Build error:
/////////////////////////////
main.cpp: In instantiation of 'main()::<lambda(auto:1)> [with auto:1 = int]':
/usr/local/include/c++/4.9.2/functional:2149:71: required by substitution of
'template<class _Res, class ... _ArgTypes> template<class _Functor> using
_Invoke = decltype
(std::__callable_functor(declval<_Functor&>())((declval<_ArgTypes>)()...))
[with _Functor = main()::<lambda(auto:1)> _Res = void; _ArgTypes = {int}]'
/usr/local/include/c++/4.9.2/functional:2225:9: required by substitution of
'template<class _Functor, class> std::function<_Res(_ArgTypes
...)>::function(_Functor) [with _Functor = main()::<lambda(auto:1)>
<template-parameter-1-2> = <missing>]'
main.cpp:7:90: required from here
main.cpp:7:58: error: 'a' was not declared in this scope
std::function<void(int)> f = [&](auto b) { std::cout << a << ", " << b <<
std::endl; };
^
/////////////////////////////
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/64791] Generic lambda fails to implicitly capture `const` variable
2015-01-25 21:33 [Bug c++/64791] New: Generic lambda fails to implicitly capture `const` variable tom at kera dot name
2015-01-25 21:36 ` [Bug c++/64791] " tom at kera dot name
@ 2015-01-25 22:14 ` tom at kera dot name
2015-01-27 12:49 ` ville.voutilainen at gmail dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tom at kera dot name @ 2015-01-25 22:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64791
--- Comment #2 from Tomalak Geret'kal <tom at kera dot name> ---
Actually, I'm no longer sure that `a` *is* odr-used...
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/64791] Generic lambda fails to implicitly capture `const` variable
2015-01-25 21:33 [Bug c++/64791] New: Generic lambda fails to implicitly capture `const` variable tom at kera dot name
2015-01-25 21:36 ` [Bug c++/64791] " tom at kera dot name
2015-01-25 22:14 ` tom at kera dot name
@ 2015-01-27 12:49 ` ville.voutilainen at gmail dot com
2015-01-27 12:53 ` ville.voutilainen at gmail dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-01-27 12:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64791
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-01-27
CC| |paolo.carlini at oracle dot com,
| |ville.voutilainen at gmail dot com
Known to work| |5.0
Ever confirmed|0 |1
Known to fail| |4.8.2, 4.9.1
--- Comment #3 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Trunk accepts the code and prints 2, 3 like clang does. So unless there's a
need for an additional testcase or a backport, this looks like a candidate for
closing.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/64791] Generic lambda fails to implicitly capture `const` variable
2015-01-25 21:33 [Bug c++/64791] New: Generic lambda fails to implicitly capture `const` variable tom at kera dot name
` (2 preceding siblings ...)
2015-01-27 12:49 ` ville.voutilainen at gmail dot com
@ 2015-01-27 12:53 ` ville.voutilainen at gmail dot com
2015-01-31 11:56 ` ville.voutilainen at gmail dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-01-27 12:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64791
--- Comment #4 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Oh, wait a minute, with trunk, I see an incorrect warning:
prog.cc: In function 'int main()':
prog.cc:7:15: warning: variable 'a' set but not used
[-Wunused-but-set-variable]
const int a = 2;
^
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/64791] Generic lambda fails to implicitly capture `const` variable
2015-01-25 21:33 [Bug c++/64791] New: Generic lambda fails to implicitly capture `const` variable tom at kera dot name
` (3 preceding siblings ...)
2015-01-27 12:53 ` ville.voutilainen at gmail dot com
@ 2015-01-31 11:56 ` ville.voutilainen at gmail dot com
2015-01-31 12:18 ` paolo.carlini at oracle dot com
2015-02-02 13:54 ` ville.voutilainen at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-01-31 11:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64791
--- Comment #6 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
I ran it with this thing:
http://melpon.org/wandbox/permlink/gAsh89NaSSFspYjq
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/64791] Generic lambda fails to implicitly capture `const` variable
2015-01-25 21:33 [Bug c++/64791] New: Generic lambda fails to implicitly capture `const` variable tom at kera dot name
` (4 preceding siblings ...)
2015-01-31 11:56 ` ville.voutilainen at gmail dot com
@ 2015-01-31 12:18 ` paolo.carlini at oracle dot com
2015-02-02 13:54 ` ville.voutilainen at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-01-31 12:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64791
--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I know that web page, but today, 20150131, I can't reproduce the issue with the
current tree on my machine.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/64791] Generic lambda fails to implicitly capture `const` variable
2015-01-25 21:33 [Bug c++/64791] New: Generic lambda fails to implicitly capture `const` variable tom at kera dot name
` (5 preceding siblings ...)
2015-01-31 12:18 ` paolo.carlini at oracle dot com
@ 2015-02-02 13:54 ` ville.voutilainen at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-02-02 13:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64791
--- Comment #9 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
I can't see any warnings with my trunk build from today, either.
^ permalink raw reply [flat|nested] 8+ messages in thread