[Issue 8480] New: to!string(BigInt, base) doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 31 03:08:44 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8480

           Summary: to!string(BigInt, base) doesn't work
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-07-31 03:08:41 PDT ---
import std.stdio: writeln;
import std.conv: to;
import std.bigint: BigInt;
void main() {
    int base = 6;
    int n1 = 588_225;
    string s1 = to!string(n1, base);
    writeln(s1);
    BigInt n2 = BigInt(n1);
    string s2 = to!string(n2, base);
    writeln(s2);
}


Expected output:

20335133
20335133


But DMD 2.060beta prints:

...\dmd2\src\phobos\std\conv.d(268): Error: template std.conv.toImpl does not
match any function template declaration
...\dmd2\src\phobos\std\conv.d(299): Error: template std.conv.toImpl cannot
deduce template function from argument types !(string)(BigInt,int)
...\dmd2\src\phobos\std\conv.d(268): Error: template instance toImpl!(string)
errors instantiating template
temp.d(10): Error: template instance std.conv.to!(string).to!(BigInt,int) error
instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list