www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17600] New: implicit float->int cast using += operator

https://issues.dlang.org/show_bug.cgi?id=17600

          Issue ID: 17600
           Summary: implicit float->int cast using += operator
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: simon.buerger rwth-aachen.de

The following code should not compile but it does, using an implicit cast that
should not be allowed.

void main()
{
 int x;
 float y;
 x += y; // implicitly casts y to int !
}

--
Jul 05