www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11490] New: Cannot copy BigInt

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: temtaime gmail.com



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: -------
Nov 10 2013
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11490


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bearophile_hugs eml.cc
         Resolution|                            |DUPLICATE



Bigint probably will become const corrected in dmd 2.065.

*** This issue has been marked as a duplicate of issue 4301 ***

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