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

2015-03-12 Thread paolo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65323

--- Comment #5 from paolo at gcc dot gnu.org paolo at gcc dot gnu.org ---
Author: paolo
Date: Thu Mar 12 23:55:49 2015
New Revision: 221402

URL: https://gcc.gnu.org/viewcvs?rev=221402root=gccview=rev
Log:
2015-03-12  Paolo Carlini  paolo.carl...@oracle.com

PR c++/65323
* decl.c (check_default_argument): Don't call
maybe_warn_zero_as_null_pointer_constant.

Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c


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

2015-03-10 Thread ktietz at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65323

Kai Tietz ktietz at gcc dot gnu.org changed:

   What|Removed |Added

 CC||ktietz at gcc dot gnu.org

--- Comment #3 from Kai Tietz ktietz at gcc dot gnu.org ---
Hmm, the issue seems to be that we emit within check_default_argument () two
times the call to maybe_warn_zero_as_null_pointer_constant ().  Once indirectly
via perform_implicit_conversion_flags () call, and then later on directly
within if-condition for returning nullptr_node.
It seems that second call is superflous in terms of warning.  So I suggest the
following patch:

Index: decl.c
===
--- decl.c  (Revision 221277)
+++ decl.c  (Arbeitskopie)
@@ -11231,7 +11233,8 @@ check_default_argument (tree decl, tree arg, tsub
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]


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

2015-03-10 Thread paolo.carlini at oracle dot com
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]


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

2015-03-09 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65323

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||diagnostic
   Priority|P3  |P2
   Target Milestone|--- |4.8.5


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

2015-03-05 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65323

Paolo Carlini paolo.carlini at oracle dot com changed:

   What|Removed |Added

Summary|-Wzero-as-null-pointer-cons |[4.8/4.9/5 Regression]
   |tant stutters   |duplicate
   ||-Wzero-as-null-pointer-cons
   ||tant warnings

--- Comment #2 from Paolo Carlini paolo.carlini at oracle dot com ---
This is in fact a regression which started when check_default_argument got a
perform_implicit_conversion_flags call near the beginning.