[Bug c++/119303] [13 Regression] ICE: error reporting routines re-entered. in warning_at (diagnostic-global-context.cc:185)

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119303

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Marek Polacek
<[email protected]>:

https://gcc.gnu.org/g:25ff510563240750c56922809bcb6ff8cca3f5c6

commit r13-10473-g25ff510563240750c56922809bcb6ff8cca3f5c6
Author: Marek Polacek <[email protected]>
Date:   Wed May 14 10:34:44 2025 -0400

    c++: fix reporting routines re-entered [PR119303]

    We crash while we call warning_at ("inline function used but never
defined")
    since it invokes dump_template_bindings -> tsubst -> ... -> convert_like ->
    ... -> c_common_truthvalue_conversion -> warning_at ("enum constant in
boolean
                                                         context")

    cp_truthvalue_conversion correctly gets complain=0 but it calls
    c_common_truthvalue_conversion from c-family which doesn't have
    a similar parameter.

    We can fix this by tweaking diagnostic_context::report_diagnostic to
    check for recursion after checking if the diagnostic was enabled.

            PR c++/116960
            PR c++/119303

    gcc/ChangeLog:

            * diagnostic.cc (diagnostic_context::report_diagnostic): Check for
            non-zero m_lock later, after checking diagnostic_enabled.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/lambda-uneval26.C: New test.
            * g++.dg/warn/undefined2.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>
    (cherry picked from commit 9ce96b683a40a12299c1d0e02727e747c00ad883)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.