www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6850] New: BigInt opBinary is not marked as pure.

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: cmsdew gmail.com



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: -------
Oct 25 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6850


irritate <irritate gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |irritate gmail.com



Issue does not occur for me on head revision, DMD v2.064.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 18 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6850


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |hsteoh quickfur.ath.cx
         Resolution|                            |WORKSFORME



Seems to have been fixed in git HEAD. Please reopen if problem still occurs in
latest release.

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