short s, t; t = -s: no (longer) works: Deprecation: integral promotion not done for -s, use

kdevel kdevel at vogtner.de
Sat Feb 24 20:07:04 UTC 2018


I don't get the point of the deprecation message:

--- intprom.d
import std.stdio;

void main ()
{
    short s, t;
    t = -s;
}
---

$ dmd intprom.d
intprom.d(6): Deprecation: integral promotion not done for -s, 
use '-transition=intpromote' switch or -cast(int)(s)

What shall I do in order to get my template code

void mymain (T) ()
{
    :
       b[i] = -b [i];
    :
}

compiled for any type for which negation is defined?


More information about the Digitalmars-d-learn mailing list