BigInt not integral type?
Jonathan M Davis
jmdavisProg at gmx.com
Sun Jun 16 02:39:20 PDT 2013
On Sunday, June 16, 2013 05:14:07 Tyro[17] wrote:
> The following code:
>
> void main()
> {
> import std.bigint;
> BigInt x, m;
> BigInt l = x & m;
> }
>
> Result in:
> andrew at ace:~$ dmd f
> f.d(6): Error: 'x' is not of integral type, it is a BigInt
> f.d(6): Error: 'm' is not of integral type, it is a BigInt
>
> I'm sure there is plans to resolve this situation but is there a work
> around I can use in the meantime?
As far as the compiler is concerned, BigInt isn't an integral type. It's a
user-defined type. But the problem isn't really whether it's an integral type
or not. The problem is that it doesn't overload opBinary with the & operator.
It overloads it for +, -, *, /, and % but not for any of the bitwise
operators. So, arguably the error message needs some improvement.
Regardless, if you want that functionality, you'll have to open an enhancement
request for it: http://d.puremagic.com/issues
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list