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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:1824da60663b4532199ecd051d8ba6da8995821d

commit r12-8152-g1824da60663b4532199ecd051d8ba6da8995821d
Author: Jason Merrill <ja...@redhat.com>
Date:   Wed Apr 13 16:42:25 2022 -0400

    c++: local fn and generic lambda [PR97219]

    When instantiating the op() for a generic lambda, we can no longer do name
    lookup inside function scopes enclosing the lambda, so we need to remember
    the lookup result from processing the definition of the lambda.  So the
code
    in finish_call_expr to throw away the lookup result and instead look it up
    again at instantiation time needs to be adjusted.  The approach I take is
to
    only discard the result if the local extern comes from dependent scope;
once
    the enclosing function template is instantiated and we're regenerating the
    lambda, then we can remember the result of lookup.  We also need any
default
    arguments to be instantiated at that point.

            PR c++/97219

    gcc/cp/ChangeLog:

            * name-lookup.cc (dependent_local_decl_p): New.
            * cp-tree.h (dependent_local_decl_p): Declare.
            * semantics.cc (finish_call_expr): Use it.
            * pt.cc (tsubst_arg_types): Also substitute default args
            for local externs.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1y/lambda-generic-local-fn1.C: New test.

Reply via email to