This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/70942] [c++14] Incorrect deduction of generic lambda `auto&&` parameter


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;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]