Hi,

shame on me. I think the patch almost qualifies as obvious. Tested x86_64-linux.

Thanks,
Paolo.

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

/cp
2012-05-10  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/53301
        * decl.c (check_default_argument): Fix typo (POINTER_TYPE_P
        instead of TYPE_PTR_P) in zero-as-null-pointer-constant warning.

/testsuite
2012-05-10  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/53301
        * g++.dg/warn/Wzero-as-null-pointer-constant-6.C: New.

Index: testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-6.C
===================================================================
--- testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-6.C    (revision 0)
+++ testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-6.C    (revision 0)
@@ -0,0 +1,6 @@
+// PR c++/53301
+// { dg-options "-Wzero-as-null-pointer-constant" }
+
+class x { public: x(int v) {} };
+
+void foo(const x& = 0);
Index: cp/decl.c
===================================================================
--- cp/decl.c   (revision 187335)
+++ cp/decl.c   (working copy)
@@ -10619,7 +10619,7 @@ check_default_argument (tree decl, tree arg)
 
   if (warn_zero_as_null_pointer_constant
       && c_inhibit_evaluation_warnings == 0
-      && (POINTER_TYPE_P (decl_type) || TYPE_PTR_TO_MEMBER_P (decl_type))
+      && (TYPE_PTR_P (decl_type) || TYPE_PTR_TO_MEMBER_P (decl_type))
       && null_ptr_cst_p (arg)
       && !NULLPTR_TYPE_P (TREE_TYPE (arg)))
     {

Reply via email to