aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/warn/Wconversion-null-3.C8
4 files changed, 21 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 01d2f91..47e79fe 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2011-11-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/48420
+ * call.c (conversion_null_warnings): For 'false' to NULL pointer,
+ just check that TREE_TYPE (expr) is a BOOLEAN_TYPE.
+
2011-11-04 Ed Smith-Rowland <3dw4rd@verizon.net>
PR c++/50941
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 4d7facc..2bf22f9 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5544,7 +5544,8 @@ conversion_null_warnings (tree totype, tree expr, tree fn, int argnum)
}
/* Issue warnings if "false" is converted to a NULL pointer */
- else if (expr == boolean_false_node && TYPE_PTR_P (totype))
+ else if (TREE_CODE (TREE_TYPE (expr)) == BOOLEAN_TYPE
+ && TYPE_PTR_P (totype))
{
if (fn)
warning_at (input_location, OPT_Wconversion_null,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 02f400e..d5a6ea5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/48420
+ * g++.dg/warn/Wconversion-null-3.C: New.
+
2011-11-04 Ed Smith-Rowland <3dw4rd@verizon.net>
PR c++/50941
diff --git a/gcc/testsuite/g++.dg/warn/Wconversion-null-3.C b/gcc/testsuite/g++.dg/warn/Wconversion-null-3.C
new file mode 100644
index 0000000..1942ee2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wconversion-null-3.C
@@ -0,0 +1,8 @@
+// PR c++/48420
+
+void foo(int* p);
+
+void bar() {
+ const bool kDebugMode = false;
+ foo(kDebugMode); // { dg-warning "converting 'false'" }
+}