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

--- 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:c310d29cac1c3a770f48ab8bb2d295ef9cc08c53

commit r15-3030-gc310d29cac1c3a770f48ab8bb2d295ef9cc08c53
Author: Nathaniel Shead <nathanielosh...@gmail.com>
Date:   Thu Aug 15 21:46:09 2024 +1000

    c++/modules: Fix type lookup in DECL_TEMPLATE_INSTANTIATIONS [PR116364]

    We need to use the DECL_TEMPLATE_INSTANTIATIONS property to find
    reachable specialisations from a template to ensure that any GM
    specialisations are properly marked as reachable.

    Currently the modules code uses the decl when rebuilding this property,
    but this is not always correct; it appears that for type specialisations
    we need to use the TREE_TYPE of the decl instead so that the
    specialisation is correctly found.  This patch makes the required
    adjustments.

            PR c++/116364

    gcc/cp/ChangeLog:

            * cp-tree.h (get_mergeable_specialization_flags): Adjust
            signature.
            * module.cc (trees_out::decl_value): Indicate whether this is a
            type or decl specialisation.
            * pt.cc (get_mergeable_specialization_flags): Match against the
            type of a non-decl specialisation.
            (add_mergeable_specialization): Use the already calculated spec
            instead of always adding decl to DECL_TEMPLATE_INSTANTIATIONS.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/tpl-spec-9_a.C: New test.
            * g++.dg/modules/tpl-spec-9_b.C: New test.
            * g++.dg/modules/tpl-spec-9_c.C: New test.

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

Reply via email to