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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <nsh...@gcc.gnu.org>:

https://gcc.gnu.org/g:4c01f40985eafccc3dd058441325b58009defd09

commit r15-7203-g4c01f40985eafccc3dd058441325b58009defd09
Author: Nathaniel Shead <nathanielosh...@gmail.com>
Date:   Sun Jan 5 23:45:05 2025 +1100

    c++/modules: Diagnose TU-local lambdas, give mangling scope to lambdas in
concepts

    This fills in a hole left in r15-6378-g9016c5ac94c557 with regards to
    detection of TU-local lambdas.  Now that LAMBDA_EXPR_EXTRA_SCOPE is
    properly set for most lambdas we can use it to detect lambdas that are
    TU-local.

    CWG2988 suggests that lambdas in concept definitions should not be
    considered TU-local, since they are always unevaluated and should never
    be emitted. This patch gives these lambdas a mangling scope (though it
    will never be actually used in name mangling).

            PR c++/116568

    gcc/cp/ChangeLog:

            * cp-tree.h (finish_concept_definition): Adjust parameters.
            (start_concept_definition): Declare.
            * module.cc (depset::hash::is_tu_local_entity): Use
            LAMBDA_EXPR_EXTRA_SCOPE to detect TU-local lambdas.
            * parser.cc (cp_parser_concept_definition): Start a lambda scope
            for concept definitions.
            * pt.cc (tsubst_lambda_expr): Namespace-scope lambdas may now
            have extra scope.
            (finish_concept_definition): Split into...
            (start_concept_definition): ...this new function.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/internal-4_b.C: Remove XFAIL, add lambda alias
            testcase.
            * g++.dg/modules/lambda-9.h: New test.
            * g++.dg/modules/lambda-9_a.H: New test.
            * g++.dg/modules/lambda-9_b.C: New test.

    Signed-off-by: Nathaniel Shead <nathanielosh...@gmail.com>
    Reviewed-by: Jason Merrill <ja...@redhat.com>

Reply via email to