Bug 11490 – Cannot copy BigInt

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-10T01:16:00Z
Last change time
2013-11-10T02:10:17Z
Assigned to
nobody
Creator
temtaime

Comments

Comment #0 by temtaime — 2013-11-10T01:16:48Z
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'
Comment #1 by bearophile_hugs — 2013-11-10T02:10:17Z
Bigint probably will become const corrected in dmd 2.065. *** This issue has been marked as a duplicate of issue 4301 ***