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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Iain Buclaw
<ibuc...@gcc.gnu.org>:

https://gcc.gnu.org/g:3b8b42f32627ca5ad029fe418a5839b9fc4512e9

commit r12-8980-g3b8b42f32627ca5ad029fe418a5839b9fc4512e9
Author: Iain Buclaw <ibuc...@gdcproject.org>
Date:   Sat Dec 10 22:11:41 2022 +0100

    d: Fix undefined reference to nested lambda in template (PR108055)

    Sometimes, nested lambdas of templated functions get no code generation
    due to them being marked as instantianted outside of all modules being
    compiled in the current compilation unit.  This despite enclosing
    template instances being marked as instantiated inside the current
    compilation unit.  To fix, all enclosing templates are now checked in
    `function_defined_in_root_p'.

    Because of this change, `function_needs_inline_definition_p' has also
    been fixed up to only check whether the regular function definition
    itself is to be emitted in the current compilation unit.

            PR d/108055

    gcc/d/ChangeLog:

            * decl.cc (function_defined_in_root_p): Check all enclosing
template
            instances for definition in a root module.
            (function_needs_inline_definition_p): Replace call to
            function_defined_in_root_p with test for outer module `isRoot'.

    gcc/testsuite/ChangeLog:

            * gdc.dg/torture/imports/pr108055conv.d: New.
            * gdc.dg/torture/imports/pr108055spec.d: New.
            * gdc.dg/torture/imports/pr108055write.d: New.
            * gdc.dg/torture/pr108055.d: New test.

    (cherry picked from commit 9fe7d3debbf60ed9fef8053123ad542a99d62100)

Reply via email to