[Bug c++/93589] Template instantiation creates a conversion warning when it should not

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Feb 24 13:18:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
No, you've misunderstood. It doesn't mean "can, if the compiler chooses to".
There is no design decision involved.

Types smaller than int *can* be promoted to int, and in certain contexts they
*are* promoted to int. The compiler doesn't get to choose when that happens.

The warning is a false positive because the range of possible values of the RHS
is such that promotion to int and back to short cannot alter the value, but
that doesn't change the fact that there *is* a promotion to int and then
conversion back to short.


More information about the Gcc-bugs mailing list