Hi,

this is a regression about duplicate warnings with -Wzero-as-null-pointer-constant. The regression is rather old, affects 4_8-branch too, and started when check_default_argument got a perform_implicit_conversion_flags call which warns a first time, then maybe_warn_zero_as_null_pointer_constant as called by check_default_argument itself warns a second time. The latter call is even older, dates back to c++/52718, I think we can now safely remove it and keep on returning nullptr_node to avoid warning later still at the call sites (that was the point of c++/52718). Tested x86_64-linux.

Thanks,
Paolo.

///////////////////
Index: decl.c
===================================================================
--- decl.c      (revision 221230)
+++ decl.c      (working copy)
@@ -11227,11 +11227,9 @@ check_default_argument (tree decl, tree arg, tsubs
                                     LOOKUP_IMPLICIT);
   --cp_unevaluated_operand;
 
-  if (warn_zero_as_null_pointer_constant
-      && TYPE_PTR_OR_PTRMEM_P (decl_type)
+  if (TYPE_PTR_OR_PTRMEM_P (decl_type)
       && null_ptr_cst_p (arg)
-      && (complain & tf_warning)
-      && maybe_warn_zero_as_null_pointer_constant (arg, input_location))
+      && !NULLPTR_TYPE_P (TREE_TYPE (arg)))
     return nullptr_node;
 
   /* [dcl.fct.default]

Reply via email to