In:

enum A {b = -1, c, d};
bool foo(A a) { return a < b || a > d; }

you get:

foo.cc: In function `bool foo(A)':
foo.cc:2: warning: comparison is always false due to limited range of data type

If an enum is always necessarily an unsigned type then the initialization of b
should get a warning or error. If it has the range of its assigned values (which
I think is what the standard says, though I'm not sure) and hence is a signed
type if any of the assigned values is negative then the issued warning is 
incorrect.

Ivan

-- 
           Summary: bad warning
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to