Is this a bug?

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 29 01:49:39 PDT 2014


On Tuesday, 29 April 2014 at 07:43:55 UTC, Andrey wrote:
> btw,
>
> short a,b,c;
>
> a = b + c; //error: cannot implicitly convert expression of 
> type 'int' to 'short'
>
> Guys!! Tell me that I have an old slutty version of the 
> compiler...

No, it's correct. `b + c` is not guaranteed to fit into `a`, 
therefore you have to cast it explicitly.


More information about the Digitalmars-d-learn mailing list