From 6dc99b79272be279641ca17348c9ea3f6fa33401 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 11 Oct 2011 01:28:34 +0000 Subject: [PATCH] re PR c++/50660 (warning about pass NULL to non pointer argument happens twice) 2011-10-10 Paolo Carlini PR c++/50660 * call.c (conversion_null_warnings): Don't look through references. From-SVN: r179779 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/call.c | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c27d8a627e8..d36ffaa83e5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-10-10 Paolo Carlini + + PR c++/50660 + * call.c (conversion_null_warnings): Don't look through references. + 2011-10-09 Paolo Carlini PR c++/38980 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index ee71d9ba6c9..4c03e76bb0c 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5514,10 +5514,9 @@ build_temp (tree expr, tree type, int flags, static void conversion_null_warnings (tree totype, tree expr, tree fn, int argnum) { - tree t = non_reference (totype); - /* Issue warnings about peculiar, but valid, uses of NULL. */ - if (expr == null_node && TREE_CODE (t) != BOOLEAN_TYPE && ARITHMETIC_TYPE_P (t)) + if (expr == null_node && TREE_CODE (totype) != BOOLEAN_TYPE + && ARITHMETIC_TYPE_P (totype)) { if (fn) warning_at (input_location, OPT_Wconversion_null, @@ -5525,11 +5524,11 @@ conversion_null_warnings (tree totype, tree expr, tree fn, int argnum) argnum, fn); else warning_at (input_location, OPT_Wconversion_null, - "converting to non-pointer type %qT from NULL", t); + "converting to non-pointer type %qT from NULL", totype); } /* Issue warnings if "false" is converted to a NULL pointer */ - else if (expr == boolean_false_node && POINTER_TYPE_P (t)) + else if (expr == boolean_false_node && TYPE_PTR_P (totype)) { if (fn) warning_at (input_location, OPT_Wconversion_null, @@ -5537,7 +5536,7 @@ conversion_null_warnings (tree totype, tree expr, tree fn, int argnum) "of %qD", argnum, fn); else warning_at (input_location, OPT_Wconversion_null, - "converting % to pointer type %qT", t); + "converting % to pointer type %qT", totype); } } -- 2.30.2