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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Nick Maclaren from comment #5)
> I did.  Please read what the C++ standard says about conversions.  4.7
> [conv.integral] paragraph 2 is a paraphrase of wording that has been in
> every C and C++ compiler since C90,

But that's not where narrowing conversions are defined.

See the examples in 8.5.4 which make it clear that converting a negative value
to an unsigned type is a narrowing conversion:

    unsigned char uc2 = {-1}; // error: narrows
    unsigned int ui1 = {-1}; // error: narrows

Those exxamples come from the proposal by Stroustrup et al:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2531.pdf

Also http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1449

"As is made plain in the examples in that paragraph, a conversion of a negative
value to an unsigned type is intended to be a narrowing conversion"

Reply via email to