As Manuel mentioned at http://gcc.gnu.org/ml/gcc-patches/2010-04/msg01425.html.
C++ have the same problem as pr32207.

extern void z();
void f() { if ( z ) z(); }
void g() { if ( z != 0 ) z(); }
void h() { if ( z != (void*)0 ) z(); }

t.C: In function ‘void f()’:
t.C:2:19: warning: the address of ‘void z()’ will always evaluate as ‘true’
[-Waddress]
t.C: In function ‘void g()’:
t.C:3:22: warning: the address of ‘void z()’ will never be NULL [-Waddress]


-- 
           Summary: missing warnings the comparison between an address with
                    a null pointer constant
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pzhao at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43906

Reply via email to