Possible implicit type conversion bug with arithmetic op=

Jarrett Billingsley kb3ctd2 at yahoo.com
Fri Jun 23 13:26:08 PDT 2006


Try this:

int x = 4.5;

It fails because you can't implicitly convert a floating point type to an 
int.

Similarly:

x = x + 4.5;

Also fails.

But:

x += 4.5;

Works, and 4.5 is implicitly converted to an int.

This happens with +=, -=, *=, /=, and %=.  The bitwise op= (&=, |=, <<=, >>= 
and >>>=) all issue errors because 4.5 is not integral.

I'm 99% sure this is a bug.  If so, I'll bugzilla it. 





More information about the Digitalmars-d-bugs mailing list