This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70942] [c++14] Incorrect deduction of generic lambda `auto&&` parameter
- From: "rs2740 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 04 May 2016 09:38:32 +0000
- Subject: [Bug c++/70942] [c++14] Incorrect deduction of generic lambda `auto&&` parameter
- Auto-submitted: auto-generated
- References: <bug-70942-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70942
TC <rs2740 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rs2740 at gmail dot com
--- Comment #1 from TC <rs2740 at gmail dot com> ---
Reduced:
int main()
{
int x = 0;
[](auto&& xv){
static_cast<decltype(xv)>(xv) = 1;
}(x);
}
OK on GCC 5. Fails with a bogus error on 6 and 7:
main.cpp: In instantiation of 'main()::<lambda(auto:1&&)> [with auto:1 = int]':
main.cpp:5:17: required by substitution of 'template<class auto:1>
main()::<lambda(auto:1&&)>::operator decltype
(((main()::<lambda(auto:1&&)>)0u).operator()(static_cast<auto:1&&>(<anonymous>)))
(*)(auto:1&&)() const [with auto:1 = int]'
main.cpp:7:8: required from here
main.cpp:6:39: error: using xvalue (rvalue reference) as lvalue
static_cast<decltype(xv)>(xv) = 1;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~