Why does intpromote spew warnings for ~ operator?
Steven Schveighoffer
schveiguy at gmail.com
Mon Sep 13 12:51:44 UTC 2021
On 9/12/21 10:14 AM, Steven Schveighoffer wrote:
> With the -preview=intpromote switch, the uncasted negation compiles and
> runs as expected.
I thought I had tested this, but I must have been wrong. With
-preview=intpromote, only the `short` version compiles, the `ushort`
version complains that you can't fit an `int` into a `ushort`.
Which is unfortunate, because most people would not use bitwise negate
on a `short`, they would do it on a `ushort`.
Still, I feel like D should allow what C allows here (and what currently
working code expects).
-Steve
More information about the Digitalmars-d
mailing list