digitalmars.D.bugs - Possible implicit type conversion bug with arithmetic op=
- Jarrett Billingsley (13/13) Jun 23 2006 Try this:
- Bruno Medeiros (5/30) Jun 26 2006 Does seem like a bug to me. Do report it.
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.
Jun 23 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
Jun 26 2006