This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/30860] New: Should warn about boolean constant false used in pointer context


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]