[Bug other/58319] explicit cast doesn't disable -Wconversion warning.

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Sep 7 17:52:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58319

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #3)
> You can ensure the value is not too large for the target:
> 
>         X x = { .field = ( u & (-1u >> 1) ) };

It would be nice if gcc accepted (unsigned int:31) as a valid type when
casting. It would help to avoid other Wconversion warnings. It seems a useful
extension to me. Just throwing out the idea there if someone (like the
reporter) considered to give it a try.


More information about the Gcc-bugs mailing list