This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/55096] New: Wconversion-nul does not work in C
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 27 Oct 2012 09:16:51 +0000
- Subject: [Bug c/55096] New: Wconversion-nul does not work in C
- Auto-submitted: auto-generated
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;
^~~~~