This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]