[Bug c++/108242] '__FUNCTION__' was not declared when used inside a generic (templated) lambda declared inside a template function

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 28 17:50:48 GMT 2022


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|'__FUNCTION__' was not      |'__FUNCTION__' was not
                   |declared when used inside a |declared when used inside a
                   |templated lambda declared   |generic (templated) lambda
                   |inside a template function  |declared inside a template
                   |                            |function
      Known to fail|                            |11.3.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced slightly more:
template<int F>
void my_fun()
{
    [&](auto) {
        static constexpr char const* fun_name = __func__;
        struct t
        {
            t() { fun_name; };
        } t1;
    }(12);
}

int main() {
    my_fun<1>();
}


More information about the Gcc-bugs mailing list