This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19437] wrong warning when assigning negative value to int
- From: "oliverst at online dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Jan 2005 14:26:54 -0000
- Subject: [Bug c++/19437] wrong warning when assigning negative value to int
- References: <20050114093847.19437.oliverst@online.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From oliverst at online dot de 2005-01-14 14:26 -------
Ah, OK. Why is there warning at all. "-1" is being assigned to an "int" and not
to an "unsigned int".
Writing it without the "? :" operator, the following code should be the same.
unsigned int i = 0;
int val;
if( i )
val = i;
else
val = -1;
So a warning, that an "unsigned int" is being assigned to an "int" would make
more sense to me. But I don't see how "-1" is being assigned to an "unsigned int".
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19437