Hello Paolo,
Paolo Carlini <[email protected]> a écrit:
> Index: cp/call.c
> ===================================================================
> --- cp/call.c (revision 181875)
> +++ cp/call.c (working copy)
> @@ -3373,7 +3373,7 @@ static struct z_candidate *
> build_user_type_conversion_1 (tree totype, tree expr, int flags)
> {
> struct z_candidate *candidates, *cand;
> - tree fromtype = TREE_TYPE (expr);
> + tree fromtype;
> tree ctors = NULL_TREE;
> tree conv_fns = NULL_TREE;
> conversion *conv = NULL;
> @@ -3382,6 +3382,11 @@ build_user_type_conversion_1 (tree totype, tree ex
> bool any_viable_p;
> int convflags;
>
> + if (!expr)
> + return NULL;
> +
> + fromtype = TREE_TYPE (expr);
> +
> /* We represent conversion within a hierarchy using RVALUE_CONV and
> BASE_CONV, as specified by [over.best.ics]; these become plain
> constructor calls, as specified in [dcl.init]. */
This might be a theoretical nit, but it looks like if expr is
error_mark_node, we'd crash as well, because of the line below that comes
right after the comment above:
gcc_assert (!MAYBE_CLASS_TYPE_P (fromtype) || !MAYBE_CLASS_TYPE_P (totype)
|| !DERIVED_FROM_P (totype, fromtype));
I don't have a test case for that though.
--
Dodji