===================================================================
@@ -0,0 +1,8 @@
+// PR c++/48420
+
+void foo(int* p);
+
+void bar() {
+ const bool kDebugMode = false;
+ foo(kDebugMode); // { dg-warning "converting 'false'" }
+}
===================================================================
@@ -5544,7 +5544,8 @@ conversion_null_warnings (tree totype, tree expr,
}
/* 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,