I have a template which has a bit where it negates a value. This
works well until it encountered a short, where ldc2 complained:
integral promotion not done for -val
I ended up with this, but is negating a short really this
problematic, or did I miss something?
static if (!__traits(isUn
On Tuesday, 5 November 2024 at 17:32:00 UTC, Andy Valencia wrote:
I ended up with this, but is negating a short really this
problematic, or did I miss something?
This is a relic from when integer promotion was added to unary
operators to match the behavior of C compilers. You can add the
`-pr
On Tuesday, 5 November 2024 at 17:32:00 UTC, Andy Valencia wrote:
I have a template which has a bit where it negates a value.
This works well until it encountered a short, where ldc2
complained:
integral promotion not done for -val
My reading of the spec is that this should be legal:
https
On Tuesday, 5 November 2024 at 19:37:32 UTC, Dennis wrote:
On Tuesday, 5 November 2024 at 17:32:00 UTC, Andy Valencia
wrote:
I ended up with this, but is negating a short really this
problematic, or did I miss something?
This is a relic from when integer promotion was added to unary
operators
On Tuesday, 5 November 2024 at 20:29:08 UTC, Andy Valencia wrote:
I still see:
tst15.d(6): Error: cannot implicitly convert expression
`-cast(int)s` of type `int` to `short`
That's right, it only removes the deprecation that requires a
double cast to fix, but you still need an explicit cast
On Wednesday, 6 November 2024 at 00:00:48 UTC, Dennis wrote:
That's right, it only removes the deprecation that requires a
double cast to fix, but you still need an explicit cast to
truncate the result of `-s` (which got promoted to `int`) back
to a `short`, unless the compiler can prove at co