[Bug c++/124459] Ignoring a pragma directive inside a module

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 12 14:47:09 GMT 2026


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

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

https://gcc.gnu.org/g:0661c5480c80bc40d9bc1cb15c3264d67c2efe9c

commit r16-8045-g0661c5480c80bc40d9bc1cb15c3264d67c2efe9c
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date:   Fri Mar 13 00:47:36 2026 +1100

    c++/modules: Support diagnostic classification changes in macros [PR124459]

    Diagnostic classification changes via _Pragma can occur in macros, but
    weren't taking effect in imported modules.  The issue is that we were
    reading the diagnostic classification map before we processed the macro
    maps, which meant that all locations in macros were just falling back
    to the abstract location of the module itself.  Fixed by moving the
    processing after we've read the macro maps.

            PR c++/124459

    gcc/cp/ChangeLog:

            * module.cc (module_state::read_initial): Move
            read_diagnostic_classification after read_macro_maps.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/warn-spec-4_a.C: New test.
            * g++.dg/modules/warn-spec-4_b.C: New test.

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


More information about the Gcc-bugs mailing list