Summary: silent implicit cast from floating point to integral
                    in += etc. operators
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Andrei Alexandrescu <> 2010-02-22 
10:28:45 PST ---
void main() {
    uint a;
    float b = 0.1;
    a += b;

This program compiles no problem. This is obviously a problem and a very
surprising behavior; I'm at the end of a 2-hours bug chasing and tried this
only after I eliminated all other opportunities for error.

For numeric types, It is ok for built-in += to perform narrowing conversion,
but not truncating ones.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to