Comment #0 by eatingstaples — 2011-01-05T18:17:38Z
Created attachment 861
Code with integer promotion
When summing two shorts, they should not be both promoted to int, especially
since this reduces the ability to pack things in registers.
I've attached code which demonstrates summing two shorts as they are both
promoted to int. The code will not build, with an error explaining that both
parameters have been promoted, leading to the expression being of type int
rather than short.
Comment #1 by bugzilla — 2011-01-05T18:42:07Z
This behavior matches C integral promotion rules, which is by design, to make it easy for C programs and programmers to transition to D.
Comment #2 by andrei — 2011-01-06T06:49:30Z
I'll leave this resolved, but in this case two shorts are summed that are known statically to be zero. Value range propagation should allow the implicit cast back to short.