bigint compile time errors

Anon via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 2 20:57:56 PDT 2015


On Friday, 3 July 2015 at 02:37:00 UTC, Paul D Anderson wrote:
> 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.

This works for me on OSX 10.10 (Yosemite) using DMD64 D Compiler 
v2.067.1.

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

Should be plusTwo(in BigInt n) instead.

> {
> 	return n + 2;
> }
>
> void main()
> {
> }
>



More information about the Digitalmars-d-learn mailing list