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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>:

https://gcc.gnu.org/g:b51ca7d2f548ffdad03fa779e3ff7bcc3441ff03

commit r16-2770-gb51ca7d2f548ffdad03fa779e3ff7bcc3441ff03
Author: Patrick Palka <ppa...@redhat.com>
Date:   Mon Aug 4 16:43:33 2025 -0400

    c++: constexpr evaluation of abi::__dynamic_cast [PR120620]

    r13-3299 changed our internal declaration of __dynamic_cast to reside
    inside the abi/__cxxabiv1:: namespace instead of the global namespace,
    matching the real declaration.  This inadvertently made us now attempt
    constexpr evaluation of user-written calls to abi::__dynamic_cast since
    cxx_dynamic_cast_fn_p now also returns true for them, but we're not
    prepared to handle arbitrary calls to __dynamic_cast, and therefore ICE.

    This patch restores cxx_dynamic_cast_fn_p to return true only for
    synthesized calls to __dynamic_cast, which can be distinguished by
    DECL_ARTIFICIAL, since apparently the synthesized declaration of
    __dynamic_cast doesn't get merged with the actual declaration.

            PR c++/120620

    gcc/cp/ChangeLog:

            * constexpr.cc (cxx_dynamic_cast_fn_p): Return true only
            for synthesized __dynamic_cast.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/constexpr-dynamic19.C: New test.
            * g++.dg/cpp2a/constexpr-dynamic1a.C: New test.

    Reviewed-by: Jason Merrill <ja...@redhat.com>

Reply via email to