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 ***