[Bug c++/41779] Spurious integral promotion
zweije at xs4all dot nl
gcc-bugzilla@gcc.gnu.org
Thu Dec 31 11:02:00 GMT 2009
------- Comment #2 from zweije at xs4all dot nl 2009-12-31 11:01 -------
I beg to differ. I cannot find where the standard says that
unsigned short *always* promotes to int in rvalue contexts.
My reading in more detail is:
1. The value of y is an lvalue of type unsigned short (5.1/7).
2. 13.3.1.2/7 mentions (effectively) promoting the
operands (because built-in candidates (13.6/12) have
promoted arguments), but it applies only when the
built-in multiplication has been selected by overload
resolution. This is not the case, because there are no
class or enum arguments.
3. Therefore, clause 5 applies directly (13.3.1.2/1).
4. Clause 5 in itself does not require promoted operands
(5.6/2), and does not distinguish lvalues from
rvalues. Therefore the value of y is promoted directly
to an lvalue of type float, through the usual arithmetic
conversion (5/9).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41779
More information about the Gcc-bugs
mailing list