[Solved] Confusing error message

Wulfklaue via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 7 06:27:05 PDT 2017


Some of the dmd error messages need some tweaking.

> import std.datetime;
>
> auto t = Clock.currStdTime;
> writeln(to!string(t));

Result in:

> Error: template core.time.to cannot deduce function from 
> argument types !(string)(long), candidates are:
> C:\D\dmd2\windows\bin\..\..\src\druntime\import\core\time.d(1709):        core.time.to(string units, T, D)(D td) if (is(_Unqual!D == TickDuration) && (units == "seconds" || units == "msecs" || units == "usecs" || units == "hnsecs" || units == "nsecs"))


> import std.datetime;
> import std.conv;
>
> auto t = Clock.currStdTime;
> writeln(to!string(t));

Solves the issue but its strange that there is no error message 
indicating that to! needs the std.conv included. Technically one 
can argue that the original message mean that but its very, very 
unclear.


More information about the Digitalmars-d-learn mailing list