This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Doubtful warning
- To: carlo at runaway dot xs4all dot nl
- Subject: Re: Doubtful warning
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Tue, 26 Jan 1999 09:16:27 +0100
- CC: egcs at cygnus dot com, egcs-bugs at cygnus dot com
- References: <199901260124.CAA02784@jolan.ppro>
> A<4294967295> v;
[...]
> The template parameter *is* unsigned - so why do I get this warning?
That doesn't matter. In C++, we look at each token individually, and
decide what it is. Then we look whether it fits into the context where
it is used.
Looking at 4294967295, we see that we have an int. However, this int
is out-of-range, so the behaviour of the program is
implementation-defined. g++ gives a warning and assumes unsigned
(after it sees that it is used in an unsigned context).
The correct program would use
A<4294967295U> v;
Martin