mirror of git://gcc.gnu.org/git/gcc.git
cvt.c (ocp_convert): Early handle the special case of a null_ptr_cst_p expr converted to a...
2018-05-05 Paolo Carlini <paolo.carlini@oracle.com> * cvt.c (ocp_convert): Early handle the special case of a null_ptr_cst_p expr converted to a NULLPTR_TYPE_P type. From-SVN: r259966
This commit is contained in:
parent
c3f57fa100
commit
39d8c7d2c1
|
|
@ -1,3 +1,8 @@
|
||||||
|
2018-05-05 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
|
* cvt.c (ocp_convert): Early handle the special case of a
|
||||||
|
null_ptr_cst_p expr converted to a NULLPTR_TYPE_P type.
|
||||||
|
|
||||||
2018-05-03 Jason Merrill <jason@redhat.com>
|
2018-05-03 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
PR c++/85600 - virtual delete failure.
|
PR c++/85600 - virtual delete failure.
|
||||||
|
|
|
||||||
15
gcc/cp/cvt.c
15
gcc/cp/cvt.c
|
|
@ -711,6 +711,15 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
|
||||||
if (error_operand_p (e))
|
if (error_operand_p (e))
|
||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
|
|
||||||
|
if (NULLPTR_TYPE_P (type) && null_ptr_cst_p (e))
|
||||||
|
{
|
||||||
|
if (complain & tf_warning)
|
||||||
|
maybe_warn_zero_as_null_pointer_constant (e, loc);
|
||||||
|
|
||||||
|
if (!TREE_SIDE_EFFECTS (e))
|
||||||
|
return nullptr_node;
|
||||||
|
}
|
||||||
|
|
||||||
if (MAYBE_CLASS_TYPE_P (type) && (convtype & CONV_FORCE_TEMP))
|
if (MAYBE_CLASS_TYPE_P (type) && (convtype & CONV_FORCE_TEMP))
|
||||||
/* We need a new temporary; don't take this shortcut. */;
|
/* We need a new temporary; don't take this shortcut. */;
|
||||||
else if (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (e)))
|
else if (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (e)))
|
||||||
|
|
@ -832,12 +841,6 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
|
||||||
/* Ignore any integer overflow caused by the conversion. */
|
/* Ignore any integer overflow caused by the conversion. */
|
||||||
return ignore_overflows (converted, e);
|
return ignore_overflows (converted, e);
|
||||||
}
|
}
|
||||||
if (NULLPTR_TYPE_P (type) && e && null_ptr_cst_p (e))
|
|
||||||
{
|
|
||||||
if (complain & tf_warning)
|
|
||||||
maybe_warn_zero_as_null_pointer_constant (e, loc);
|
|
||||||
return nullptr_node;
|
|
||||||
}
|
|
||||||
if (POINTER_TYPE_P (type) || TYPE_PTRMEM_P (type))
|
if (POINTER_TYPE_P (type) || TYPE_PTRMEM_P (type))
|
||||||
return cp_convert_to_pointer (type, e, dofold, complain);
|
return cp_convert_to_pointer (type, e, dofold, complain);
|
||||||
if (code == VECTOR_TYPE)
|
if (code == VECTOR_TYPE)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue