re PR c++/50660 (warning about pass NULL to non pointer argument happens twice)
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 11 Oct 2011 01:28:34 +0000 (01:28 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 11 Oct 2011 01:28:34 +0000 (01:28 +0000)
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

gcc/cp/ChangeLog
gcc/cp/call.c

index c27d8a627e8fec71f9ec547b0d243d5ea08dd130..d36ffaa83e591bca3f9e8eded7ed15d68a4e6cf4 100644 (file)
@@ -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
index ee71d9ba6c99af009d3f076cc142b8051625967b..4c03e76bb0c8a64ccc587438651d914142e08989 100644 (file)
@@ -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);
     }
 }