[Issue 11490] New: Cannot copy BigInt

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 10 01:16:50 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11490

           Summary: Cannot copy BigInt
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: temtaime at gmail.com


--- Comment #0 from Temtaime <temtaime at gmail.com> 2013-11-10 01:16:48 PST ---
import std.stdio;
import std.bigint;

void foo(ref in BigInt a) {
    BigInt b = a;

    b ^^= 100;
    b.writeln;
}


void main() {
    BigInt a = 10;

    foo(a);
    a.writeln;
}

Causes
Error: cannot implicitly convert expression (a) of type const(BigInt) to BigInt


It forbids from copying BitInt where it's const/immutable at all.

Also code
void foo(ref in BigInt a) {
    BigInt b = a * 10;
    b.writeln;
}

Fails with:
Error: incompatible types for ((a) * (10)): 'const(BigInt)' and 'int'

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


More information about the Digitalmars-d-bugs mailing list