+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>
PR c++/85600 - virtual delete failure.
if (error_operand_p (e))
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))
/* We need a new temporary; don't take this shortcut. */;
else if (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (e)))
/* Ignore any integer overflow caused by the conversion. */
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))
return cp_convert_to_pointer (type, e, dofold, complain);
if (code == VECTOR_TYPE)