[Bug c/55096] New: Wconversion-nul does not work in C
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Oct 27 09:17:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55096
Bug #: 55096
Summary: Wconversion-nul does not work in C
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: manu@gcc.gnu.org
From: http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html
#include <stdbool.h>
bool foo(void);
bool * ProcessRequest(bool *charge_acct) {
if (foo()) {
charge_acct = false;
}
return charge_acct;
}
gcc -Wall -Wconversion -Wextra: silence :-(
g++
test2.cc:5:17: warning: converting ‘false’ to pointer type ‘bool*’
[-Wconversion-null]
charge_acct = false;
^
clang/clang++
test2.cc:5:19: warning: initialization of pointer of type 'bool *' to null from
a constant boolean expression [-Wbool-conversion]
charge_acct = false;
^~~~~
More information about the Gcc-bugs
mailing list