This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/64791] Generic lambda fails to implicitly capture `const` variable
- From: "tom at kera dot name" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 25 Jan 2015 21:34:17 +0000
- Subject: [Bug c++/64791] Generic lambda fails to implicitly capture `const` variable
- Auto-submitted: auto-generated
- References: <bug-64791-4 at http dot gcc dot gnu dot org/bugzilla/>
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; };
^
/////////////////////////////