dmd failed or dub wrong?

mogu via Digitalmars-d digitalmars-d at puremagic.com
Tue May 24 16:47:25 PDT 2016


I use dub 0.9.25, DMD64 D Compiler v2.071.0. Create a minimal 
project and write the following codes in main function.

```
import std.math;
long i = 0;
i += 3.5.floor;
```

Then run dub will get a warning and dmd failed.

```
source/app.d(4,7): Warning: long += double is performing 
truncating conversion
dmd failed with exit code 1.
```

But build the app.d directly use dmd. It's OK. However if the 
last line of code above is `i = 3.5.floor;`. An error occurs.

```
Error: cannot implicitly convert expression (floor(3.5)) of type 
double to long
```

So what's the deal?


More information about the Digitalmars-d mailing list