Possible implicit type conversion bug with arithmetic op=

Bruno Medeiros brunodomedeirosATgmail at SPAM.com
Mon Jun 26 04:40:18 PDT 2006


Jarrett Billingsley wrote:
> 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. 
> 
> 

Does seem like a bug to me. Do report it.

-- 
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d-bugs mailing list