The following code fails to compile and responds with the given error message. Varying the "plusTwo" function doesn't work; as long as there is an arithmetic operation the error occurs.

It seems to mean that there is no way to modify a BigInt at compile time. This seriously limits the usability of the type.

enum BigInt test1 = BigInt(123);
enum BigInt test2 = plusTwo(test1);

public static BigInt plusTwo(in bigint n)
{
        return n + 2;
}

void main()
{
}

Error message:

C:\D\dmd2\windows\bin\..\..\src\phobos\std\internal\math\biguintx86.d(226): 
Error: asm statements cannot be interpreted at compile time
C:\D\dmd2\windows\bin\..\..\src\phobos\std\internal\math\biguintcore.d(1248):   
     called from here: multibyteIncrementAssign(result[0..__dollar - 1u], lo)
C:\D\dmd2\windows\bin\..\..\src\phobos\std\internal\math\biguintcore.d(515):    
    called from here: addInt(x.data, y)
C:\D\dmd2\windows\bin\..\..\src\phobos\std\bigint.d(118): called from here: addOrSubInt(this.data, u, cast(int)this.sign != cast(int)(y < 0u), this.sign) C:\D\dmd2\windows\bin\..\..\src\phobos\std\bigint.d(118): called from here: addOrSubInt(this.data, u, cast(int)this.sign != cast(int)(y < 0u), this.sign) C:\D\dmd2\windows\bin\..\..\src\phobos\std\bigint.d(258): called from here: r.opOpAssign(y)
called from here: n.opBinary(2)
called from here: plusTwo(BigInt(BigUint([123u], false))


Reply via email to