Operator implicit conversion difference

ixid via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 5 05:20:24 PST 2015


This may have been overlooked in my other thread so I wanted to 
ask again:

This seems very inconsistent, does a += b not lower to a = a + b? 
I guess not based on the below:

     ushort a = ushort.max, b = ushort.max;


     a += b; // Compiles fine
     a = a + b; // Error: cannot implicitly convert expression 
(cast(int)a + cast(int)b) of type int to ushort


More information about the Digitalmars-d-learn mailing list