Compiling

#define FIVE 5

int main()
{
    int i = 5;
    int const ic = 5;

    i < 5u;
    ic < 5u;
    FIVE < 5u; // line 10
}


with -Wsign-compare produces the output

pp.cpp:8: warning: comparison between signed and unsigned integer expressions
pp.cpp:9: warning: comparison between signed and unsigned integer expressions


MSVC only warns on line 8.  G++'s current behaviour is unfortunate because it 
favors #defines over consts.

Regards,
Bruno Martínez

-- 
           Summary: -Wsign-compare and const propagation
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: br1 at internet dot com dot uy
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to