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

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Jason Merrill
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:e2a178a5110db3b4c25773d386b047b27679bfe5

commit r14-11534-ge2a178a5110db3b4c25773d386b047b27679bfe5
Author: Jason Merrill <ja...@redhat.com>
Date:   Fri Apr 4 17:34:08 2025 -0400

    c++: __FUNCTION__ in lambda return type [PR118629]

    In this testcase, the use of __FUNCTION__ is within a function parameter
    scope, the lambda's.  And P1787 changed __func__ to live in the parameter
    scope.  But [basic.scope.pdecl] says that the point of declaration of
    __func__ is immediately before {, so in the trailing return type it isn't
in
    scope yet, so this __FUNCTION__ should refer to foo().

    Looking first for a block scope, then a function parameter scope, gives us
    the right result.

            PR c++/118629

    gcc/cp/ChangeLog:

            * name-lookup.cc (pushdecl_outermost_localscope): Look for an
            sk_block.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/lambda/lambda-__func__3.C: New test.

    (cherry picked from commit 7d561820525fd3b9d8f3876333c0584d75e7c053)

Reply via email to