Annoyance with new integer promotion deprecations
H. S. Teoh
hsteoh at quickfur.ath.cx
Mon Feb 5 19:22:26 UTC 2018
Code:
struct S {
byte[2] x;
}
void main() {
S s, t;
s.x = [ 1, -1 ]; // OK
t.x = [ -s.x[0], -s.x[1] ]; // NG (line 7)
}
Compiler says:
/tmp/test.d(7): Deprecation: integral promotion not done for `-s.x[0]`, use '-transition=intpromote' switch or `-cast(int)(s.x[0])`
/tmp/test.d(7): Deprecation: integral promotion not done for `-s.x[1]`, use '-transition=intpromote' switch or `-cast(int)(s.x[1])`
Why should I need to explicitly cast to int only to reassign it back to
byte?! This is ridiculous.
T
--
Making non-nullable pointers is just plugging one hole in a cheese grater. -- Walter Bright
More information about the Digitalmars-d
mailing list