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

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

commit r15-3937-gcf9efe5ec14fea3ad5746fbefb22544bb9424d9d
Author: Nathaniel Shead <nathanielosh...@gmail.com>
Date:   Fri Sep 27 18:58:27 2024 +1000

    c++/modules: Propagate purview/import for templates in duplicate_decls
[PR116803]

    We need to ensure that for a declaration in the module purview, that the
    resulting declaration has PURVIEW_P set and IMPORT_P cleared so that we
    understand it might be something requiring exporting.  This is normally
    handled for a declaration by set_instantiating_module, but when this
    declaration is a redeclaration duplicate_decls needs to propagate this
    to olddecl.

    This patch only changes the logic for template declarations, because in
    the non-template case the whole contents of olddecl's DECL_LANG_SPECIFIC
    is replaced with newdecl's (which includes these flags), so there's
    nothing to do.

            PR c++/116803

    gcc/cp/ChangeLog:

            * decl.cc (duplicate_decls): Propagate DECL_MODULE_PURVIEW_P and
            DECL_MODULE_IMPORT_P for template redeclarations.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/merge-18_a.H: New test.
            * g++.dg/modules/merge-18_b.H: New test.
            * g++.dg/modules/merge-18_c.C: New test.

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

Reply via email to