https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115501
--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:71f484d02b2b3e8616cd7af27a0d4c72e4c7e977 commit r15-1620-g71f484d02b2b3e8616cd7af27a0d4c72e4c7e977 Author: Marek Polacek <pola...@redhat.com> Date: Tue Jun 18 10:50:49 2024 -0400 c++: ICE with __dynamic_cast redecl [PR115501] Since r13-3299, build_dynamic_cast_1 calls pushdecl which calls duplicate_decls and that in this testcase emits the "conflicting declaration" error and returns error_mark_node, so the subsequent build_cxx_call crashes on the error_mark_node. PR c++/115501 gcc/cp/ChangeLog: * rtti.cc (build_dynamic_cast_1): Return if dcast_fn is erroneous. gcc/testsuite/ChangeLog: * g++.dg/rtti/dyncast8.C: New test.