[Issue 6850] New: BigInt opBinary is not marked as pure.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 25 04:55:30 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6850

           Summary: BigInt opBinary is not marked as pure.
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: cmsdew at gmail.com


--- Comment #0 from Chris Dew <cmsdew at gmail.com> 2011-10-25 04:54:24 PDT ---
The code below illustrates the issue.

Thanks,

Chris.


gcd.d:

import std.stdio;
import std.bigint;

pure BigInt gcd(BigInt a, BigInt b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  BigInt n = "10000000000";
  writefln("%s", gcd(cast(BigInt)48, n));
  return 0;
}

./gcd.d(6): Error: pure function 'gcd' cannot call impure function 'opBinary'
Failed: dmd  -v -o- './gcd.d' -I'.' >./gcd.d.deps

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list