This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/30860] New: Should warn about boolean constant false used in pointer context
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Feb 2007 15:27:02 -0000
- Subject: [Bug c++/30860] New: Should warn about boolean constant false used in pointer context
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
void foo(const char *);
void bar() { foo(false); }
should warn that 'false' is interpreted as NULL pointer constant and as such
is convertible to const char *. (Through false -> (int)0 -> NULL -> (const
char *)0)
As foo(true) is (rightfully) rejected the case above is usually not intended.
See 4.10.
--
Summary: Should warn about boolean constant false used in pointer
context
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30860