This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
C++ regression: comparing unsigned against integer literal
- From: Gerald Pfeifer <gerald at pfeifer dot com>
- To: gcc at gcc dot gnu dot org
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Thu, 10 Jul 2003 15:14:34 +0200 (CEST)
- Subject: C++ regression: comparing unsigned against integer literal
I'm having a hard time with my daily builds and regression tests lately,
and here is another, fresh issue: Given the following program
extern unsigned u;
int g() { return u > 1; }
template<class F>
int f() { return u > 1; }
gccvs y.cc -Wall warns about the second comparison (in the template
function) but does not warn for the regular function:
y.cc: In function `int f()':
y.cc:6: warning: comparison between signed and unsigned integer expressions
GCC used to warn in neither case, and I think that's highly preferrable
for constants in the range [0..INT_MAX].
Gerald