digitalmars.D.learn - BigInt not integral type?
- Tyro[17] (22/22) Jun 16 2013 The following code:
- Jonathan M Davis (9/25) Jun 16 2013 As far as the compiler is concerned, BigInt isn't an integral type. It's...
The following code: void main() { import std.bigint; BigInt x, m; BigInt l = x & m; } Result in: andrew 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? Thanks, -- Andrew Edwards -------------------- http://www.akeron.co auto getAddress() { string location = " ", period = "."; return ("info" ~ location ~ "afidem" ~ period ~ "org"); }
Jun 16 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 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
Jun 16 2013