diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2011-10-11 01:28:34 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2011-10-11 01:28:34 +0000 |
commit | 6dc99b79272be279641ca17348c9ea3f6fa33401 (patch) | |
tree | fe255d479ad6c27f9842df0951e0bbc6e0d680d1 /gcc | |
parent | e44f4f11a5ce36ccaad80be49d7cde26817686ee (diff) | |
download | gcc-6dc99b79272be279641ca17348c9ea3f6fa33401.zip gcc-6dc99b79272be279641ca17348c9ea3f6fa33401.tar.gz gcc-6dc99b79272be279641ca17348c9ea3f6fa33401.tar.bz2 |
re PR c++/50660 (warning about pass NULL to non pointer argument happens twice)
2011-10-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50660
* call.c (conversion_null_warnings): Don't look through references.
From-SVN: r179779
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/call.c | 11 |
2 files changed, 10 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c27d8a6..d36ffaa 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-10-10 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/50660 + * call.c (conversion_null_warnings): Don't look through references. + 2011-10-09 Paolo Carlini <paolo.carlini@oracle.com> PR c++/38980 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index ee71d9b..4c03e76 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 %<false%> to pointer type %qT", t); + "converting %<false%> to pointer type %qT", totype); } } |