http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44277

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-17 
23:12:58 UTC ---
Jason, would it make sense to produce the warning in cp_convert_to_pointer? I
see the function does *not* have a complain argument (which would be used in
the existing error calls), and that is good because it means we should be safe
wrt undesired warnings in sfinae. Then, about the below, I guess we have also
to decide what to do wrt pointers to members: the same? Then, we'll have also
to decide the exact *name* of the  warning... So many questions ;)

////////////

--- cvt.c       (revision 180110)
+++ cvt.c       (working copy)
@@ -209,7 +209,11 @@ cp_convert_to_pointer (tree type, tree expr)
          expr = build_int_cst_type (type, -1);
        }
       else
-       expr = build_int_cst (type, 0);
+       {
+         if (!NULLPTR_TYPE_P (TREE_TYPE (expr)))
+           warning (0, "zero as null pointer constant");
+         expr = build_int_cst (type, 0);
+       }

       return expr;
     }

Reply via email to