Bug 6850 – BigInt opBinary is not marked as pure.

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2011-10-25T04:54:00Z
Last change time
2013-07-08T20:56:15Z
Assigned to
nobody
Creator
cmsdew

Comments

Comment #0 by cmsdew — 2011-10-25T04:54:24Z
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
Comment #1 by irritate — 2013-06-18T16:15:08Z
Issue does not occur for me on head revision, DMD v2.064.
Comment #2 by hsteoh — 2013-07-08T20:56:15Z
Seems to have been fixed in git HEAD. Please reopen if problem still occurs in latest release.