[Bug c++/79378] lambda init-capture adds const

vittorio.romeo at outlook dot com gcc-bugzilla@gcc.gnu.org
Sat Jul 18 11:39:16 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79378

Vittorio Romeo <vittorio.romeo at outlook dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vittorio.romeo at outlook dot com

--- Comment #2 from Vittorio Romeo <vittorio.romeo at outlook dot com> ---
Stumbled upon this again, with this example:

    template <typename, typename>
    constexpr bool is_same_v = false;

    template <typename T>
    constexpr bool is_same_v<T, T> = true;

    auto l = [k = 0]
    {
        static_assert(is_same_v<decltype(k), int>);
    };

This bug is still not fixed in the latest version of GCC (trunk).

Related StackOverflow post: 
https://stackoverflow.com/questions/62963712/decltype-of-generalized-lambda-capture-inside-body-of-a-lambda-gcc-vs-clang

Example on Compiler Explorer:
https://gcc.godbolt.org/z/jY9cfW


More information about the Gcc-bugs mailing list