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

--- Comment #6 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:215ff991a8681f968823b913e1c79a32d339c097

commit r15-3207-g215ff991a8681f968823b913e1c79a32d339c097
Author: Nathaniel Shead <nathanielosh...@gmail.com>
Date:   Thu Aug 22 20:41:54 2024 +1000

    c++/modules: Fix include translation for already-seen headers [PR99243]

    After importing a header unit we learn about and setup any header
    modules that we transitively depend on.  However, this causes
    'set_filename' to fail an assertion if we then come across this header
    as an #include and attempt to translate it into a module.  We still need
    to do this translation so that libcpp learns that this is a header unit,
    but we shouldn't error just because we've already seen it as an import.

    Instead this patch merely checks and errors to handle the case of a
    broken mapper implementation which supplies a different CMI path from
    the one we already got.

    As a drive-by fix, also make failing to find the CMI for a module be a
    fatal error: any further errors in the TU are unlikely to be helpful.

            PR c++/99243

    gcc/cp/ChangeLog:

            * module.cc (module_state::set_filename): Handle repeated calls
            to 'set_filename' as long as the CMI path matches.
            (maybe_translate_include): Adjust comment.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/map-2.C: Prune additional fatal error message.
            * g++.dg/modules/inc-xlate-4_a.H: New test.
            * g++.dg/modules/inc-xlate-4_b.H: New test.
            * g++.dg/modules/inc-xlate-4_c.H: New test.

    Signed-off-by: Nathaniel Shead <nathanielosh...@gmail.com>
  • [Bug c++/99243] [modules] ICE i... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to