bigint implicit cast to bool breaks code

Paul D. Anderson nobody at hotmail.com
Thu May 30 16:26:30 PDT 2013


On Thursday, 30 May 2013 at 22:32:08 UTC, Paul D. Anderson wrote:
> Issue 4120 added an implicit cast for BigInt to a boolean value.
>
> This used to work:
>
> /// Returns a mutable copy of a BigInt
> public BigInt mutable(const BigInt num)
> {
> 	BigInt big = cast(BigInt)num;
> 	return big;
> }
>
> But it now generates an error:
>
> Error: template instance opCast!(BigInt) does not match 
> template declaration opCast(T : bool)()
>
> Is there another way to make a mutable copy of a BigInt?

This doesn't work either, by the way:

     BigInt big = BigInt(num);

Error: template std.bigint.BigInt._ctor does not match any 
function template declaration. Candidates are:
... std.bigint.BigInt.__ctor(T : const(char)[](T s)
... std.bigint.BigInt.__ctor(T x) if (isIntegral!(T))


More information about the Digitalmars-d mailing list