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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu.org

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #6)
> 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);

Most likely that check should be after the `!dcast_fn` check rather than inside
it so if you try to use dynamic_cast twice, the second one would not cause an
ICE.

Reply via email to