[Bug c++/8715] '~' operator for unsigned char and conversion to bool
rearnsha at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Jan 26 17:03:00 GMT 2007
------- Comment #9 from rearnsha at gcc dot gnu dot org 2007-01-26 17:03 -------
(In reply to comment #8)
> I meant that the warning is appropriate but
> the message is confusing because it is exposing that when doing
>
> bool x = ~b;
>
> we actually do
>
> bool x = (~b != 0);
>
Or, more precisely,
bool x = (~(int) b) != 0;
> So an appropriate message would say something like:
>
> test.cpp:5: warning: '(bool) ~b' is always true
> Don't you agree?
>
Yes, that would be nice, but hard to implement.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8715
More information about the Gcc-bugs
mailing list