From b7e7f412087e6682057ed98df6c466d5da342f6e Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 12 Mar 2015 23:55:49 +0000 Subject: [PATCH] re PR c++/65323 (duplicate -Wzero-as-null-pointer-constant warnings) 2015-03-12 Paolo Carlini PR c++/65323 * decl.c (check_default_argument): Don't call maybe_warn_zero_as_null_pointer_constant. From-SVN: r221402 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl.c | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f350705c376..259ce9c9839 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-03-12 Paolo Carlini + + PR c++/65323 + * decl.c (check_default_argument): Don't call + maybe_warn_zero_as_null_pointer_constant. + 2015-03-11 Aldy Hernandez * cp-gimplify.c (simple_empty_class_p): New. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 54e6418b322..e35e48436dc 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -11229,11 +11229,10 @@ check_default_argument (tree decl, tree arg, tsubst_flags_t complain) LOOKUP_IMPLICIT); --cp_unevaluated_operand; - 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)) + /* Avoid redundant -Wzero-as-null-pointer-constant warnings at + the call sites. */ + if (TYPE_PTR_OR_PTRMEM_P (decl_type) + && null_ptr_cst_p (arg)) return nullptr_node; /* [dcl.fct.default] -- 2.30.2