www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - metastrings.ToString

A bug in Phobos.

--- foo.d ---
import std.metastrings;
pragma(msg,ToString!(0x100000000));

void main() {}
-------------


 dmd foo.d
0 D:\tool\program\d\dmd\bin\..\..\dm\bin\link.exe test,,,user32+kernel32/noi; An above result is bug. A correct result is:
 dmd test.d
4294967296 D:\tool\program\d\dmd\bin\..\..\dm\bin\link.exe test,,,user32+kernel32/noi; Need To modify std/metastrings.d: /// ditto template ToString(long I) { static if (I < 0) const char[] ToString = "-" ~ ToString!(cast(ulong)(-I)); else const char[] ToString = ToString!(cast(uint)I); // <- "uint" to "ulong" }
Apr 05 2007