https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115501
Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> --- build_dynamic_cast_1 now calls pushdecl which calls duplicate_decls and that emits the "conflicting declaration" error and returns error_mark_node, so the subsequent build_cxx_call crashes on the error_mark_node. Maybe we need just: --- a/gcc/cp/rtti.cc +++ b/gcc/cp/rtti.cc @@ -793,6 +793,8 @@ build_dynamic_cast_1 (location_t loc, tree type, tree expr, dcast_fn = pushdecl (dcast_fn, /*hiding=*/true); pop_abi_namespace (flags); dynamic_cast_node = dcast_fn; + if (dcast_fn == error_mark_node) + return error_mark_node; } result = build_cxx_call (dcast_fn, 4, elems, complain); SET_EXPR_LOCATION (result, loc);