mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-06 02:20:34 +08:00
re PR c++/48420 (Missed -Wconversion-null warning when passing const bool to T*)
/cp 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. /testsuite 2011-11-04 Paolo Carlini <paolo.carlini@oracle.com> PR c++/48420 * g++.dg/warn/Wconversion-null-3.C: New. From-SVN: r180963
This commit is contained in:
parent
e4fe948a6e
commit
92b4d64cd4
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
8
gcc/testsuite/g++.dg/warn/Wconversion-null-3.C
Normal file
8
gcc/testsuite/g++.dg/warn/Wconversion-null-3.C
Normal file
@ -0,0 +1,8 @@
|
||||
// PR c++/48420
|
||||
|
||||
void foo(int* p);
|
||||
|
||||
void bar() {
|
||||
const bool kDebugMode = false;
|
||||
foo(kDebugMode); // { dg-warning "converting 'false'" }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user