re PR c++/51196 (FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C)
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 22 Nov 2011 15:04:27 +0000 (15:04 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 22 Nov 2011 15:04:27 +0000 (15:04 +0000)
2011-11-22  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/51196
* typeck.c (cp_build_binary_op, [case EQ_EXPR]): For targets having
TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta, do here
the -Wzero-as-null-pointer-constant warning for pmf == 0.

From-SVN: r181620

gcc/cp/ChangeLog
gcc/cp/typeck.c

index 0d729a9f514bf573d4f5bf38f07928449431b50b..e797a7470fa2fa662f687832022f57747830ee10 100644 (file)
@@ -1,3 +1,10 @@
+2011-11-22  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/51196
+       * typeck.c (cp_build_binary_op, [case EQ_EXPR]): For targets having
+       TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta, do here
+       the -Wzero-as-null-pointer-constant warning for pmf == 0.
+
 2011-11-21  Torvald Riegel  <triegel@redhat.com>
 
        * pt.c (tsubst_copy_and_build): Handle TRANSACTION_EXPR.
index a23e27491d8c8056290d6504bf3b78d605b51ce9..9a5365c612c4a81aa62e29224f08e8e0b8df0f1f 100644 (file)
@@ -4056,6 +4056,13 @@ cp_build_binary_op (location_t location,
                                            delta0,
                                            integer_one_node,
                                            complain);
+             
+             if ((complain & tf_warning)
+                 && c_inhibit_evaluation_warnings == 0
+                 && !NULLPTR_TYPE_P (TREE_TYPE (op1)))
+               warning (OPT_Wzero_as_null_pointer_constant,
+                        "zero as null pointer constant");
+
              e2 = cp_build_binary_op (location,
                                       EQ_EXPR, e2, integer_zero_node,
                                       complain);