------- Additional Comments From igodard at pacbell dot net 2005-02-17 03:09
-------
Turns out that the promotion rules aren't the problem, because you still get the
same message even with *explicit* promotion - the code:
#include <cstddef>
static const char lwb = 0x80;
static const char upb = 0x7f;
static const size_t cnt = int(upb) - int(lwb) + 1;
int main() {
return 0;
}
gets you:
~/ootbc/common/src$ c++ foo.cc
foo.cc:5: warning: integer overflow in expression
which *has* to be wrong regardless of the promotion rules.
Ivan
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20019