[Bug c/51712] -Wtype-limits should not trigger for types of implementation-defined signedness

jrnieder at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Apr 17 18:19:00 GMT 2012


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

--- Comment #4 from Jonathan Nieder <jrnieder at gmail dot com> 2012-04-17 18:13:08 UTC ---
I am not convinced clang's heuristic is the right one.  For example, the
following code trips clang's warning, but the test is still not redundant. The
main advantage of the "enumerators equal to zero are not zero constants"
heuristic is that it means there is at least one idiom for checking that an
enum value is in range that clang won't warn about.

enum test_enum {
    FOO = 0,
    BAR
};

int valid(enum test_enum arg)
{
    return arg >= 0 && arg <= 1;
}



More information about the Gcc-bugs mailing list