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

Implicit conversion for bigint array append #18577

Open
dlangBugzillaToGithub opened this issue May 3, 2013 · 1 comment
Open

Implicit conversion for bigint array append #18577

dlangBugzillaToGithub opened this issue May 3, 2013 · 1 comment

Comments

@dlangBugzillaToGithub
Copy link

bearophile_hugs reported this on 2013-05-03T16:43:51Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=10025

CC List

  • yebblies

Description

import std.bigint: BigInt;
void main() {
    auto p = new BigInt[1];
    p[0] = BigInt(1); // OK
    p[0] = 1;         // OK
    p ~= BigInt(1);   // OK
    p ~= 1;           // Error
}



DMD 2.063beta:

test.d(7): Error: cannot append type int to type BigInt[]
@dlangBugzillaToGithub
Copy link
Author

yebblies commented on 2013-08-02T21:27:07Z

>     p[0] = 1;         // OK

This is assignment, so it works.

>    p ~= 1;           // Error

This would be implicit construction of a BigInt from an int.

That makes this an enhancement request for implicit construction on append.

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

1 participant