On 01/17/2018 08:40 PM, rumbu wrote:
This started in the last DMD version (2.078):

byte b = -10;
ulong u = b < 0 ? -b : b;

//Deprecation: integral promotion not done for `-b`, use '-transition=intpromote' switch or `-cast(int)(b)

Why do I need a to promote a byte to int to obtain an ulong? Even in the extreme case where b is byte.min, -byte.min as unsigned is exactly what i need: 128;

Actually, for b = byte.min, you get u = 18446744073709551488.

2.078 is starting to fix this so that you get 128. But that's a breaking change, so you have to use the compiler switch or the cast for a couple releases.

In the changelog: https://dlang.org/changelog/2.078.0.html#fix16997

Reply via email to