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

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

https://gcc.gnu.org/g:828c48f0680e209e96bcb76a232665ed047e92cc

commit r16-3225-g828c48f0680e209e96bcb76a232665ed047e92cc
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Aug 15 22:36:18 2025 +0200

    c++: Implement C++20 P1766R1 - Mitigating minor modules maladies [PR121552]

    The following patch attempts to implement the
    C++20 P1766R1 - Mitigating minor modules maladies
    paper.
    clang++ a few years ago introduced for the diagnostics required in
    the paper -Wnon-c-typedef-for-linkage pedwarn and the following patch
    does that too.
    The paper was accepted as a DR, the patch enables the warning
    also for C++98, dunno whether it might not be better to do it only
    for C++11 onwards.

    The paper is also about differences in default arguments of functions
    in different TUs and in modules, I think within the same TU we diagnose
    it correctly (maybe I should add some testcase) and perhaps try
    something with modules as well.  But in different TUs it is IFNDR.

    2025-08-15  Jakub Jelinek  <ja...@redhat.com>

            PR c++/121552
    gcc/
            * doc/invoke.texi (-Wno-non-c-typedef-for-linkage): Document.
    gcc/c-family/
            * c.opt (Wnon-c-typedef-for-linkage): New option.
            * c.opt.urls: Regenerate.
    gcc/cp/
            * decl.cc: Implement C++20 P1766R1 - Mitigating minor modules
maladies.
            (diagnose_non_c_class_typedef_for_linkage,
            maybe_diagnose_non_c_class_typedef_for_linkage): New functions.
            (name_unnamed_type): Call
            maybe_diagnose_non_c_class_typedef_for_linkage.
    gcc/testsuite/
            * g++.dg/cpp2a/typedef1.C: New test.
            * g++.dg/debug/dwarf2/typedef5.C: Add
-Wno-non-c-typedef-for-linkage
            to dg-options.
            * g++.dg/inherit/typeinfo1.C: Add -Wno-non-c-typedef-for-linkage
            to dg-additional-options.
            * g++.dg/parse/ctor2.C: Likewise.
            * g++.dg/ext/anon-struct9.C: Add -Wno-non-c-typedef-for-linkage to
            dg-options.
            * g++.dg/ext/visibility/anon11.C: Add
-Wno-non-c-typedef-for-linkage
            to dg-additional-options.
            * g++.dg/lto/pr69137_0.C: Add -Wno-non-c-typedef-for-linkage
            to dg-lto-options.
            * g++.dg/other/anon8.C: Add -Wno-non-c-typedef-for-linkage
            to dg-additional-options.
            * g++.dg/template/pr84973.C: Likewise.
            * g++.dg/template/pr84973-2.C: Likewise.
            * g++.dg/template/pr84973-3.C: Likewise.
            * g++.dg/abi/anon2.C: Likewise.
            * g++.dg/abi/anon3.C: Likewise.
            * g++.old-deja/g++.oliva/linkage1.C: Likewise.

Reply via email to