This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/65323] [4.8/4.9/5 Regression] duplicate -Wzero-as-null-pointer-constant warnings


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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I sent a patch to the mailing list about this. If we don't want to apply it and
we want to be super-conservative, we can indeed simply do this, with a comment,
in my opinion:

@@ -11227,11 +11243,14 @@
                                     LOOKUP_IMPLICIT);
   --cp_unevaluated_operand;

+  /* FIXME: should be OK to just check
+     TYPE_PTR_OR_PTRMEM_P (decl_type) && null_ptr_cst_p (arg).  */
   if (warn_zero_as_null_pointer_constant
       && 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))
+      && c_inhibit_evaluation_warnings == 0
+      && !NULLPTR_TYPE_P (TREE_TYPE (arg)))
     return nullptr_node;

   /* [dcl.fct.default]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]