Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to!string(BigInt, base) doesn't work #9930

Open
dlangBugzillaToGithub opened this issue Jul 31, 2012 · 0 comments
Open

to!string(BigInt, base) doesn't work #9930

dlangBugzillaToGithub opened this issue Jul 31, 2012 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

bearophile_hugs reported this on 2012-07-31T03:08:41Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=8480

Description

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants