Bug 4340 – Arithmetic impossible with const BigInt

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2010-06-17T02:12:00Z
Last change time
2010-06-17T04:02:50Z
Assigned to
nobody
Creator
pelle.mansson

Comments

Comment #0 by pelle.mansson — 2010-06-17T02:12:02Z
This program: import std.bigint; void main() { const BigInt a = 1; const BigInt b = a + 1; } gives this: test5.d(6): Error: template std.bigint.BigInt.opBinary(string op,T) if ((op == "+" || op == "*" || op == "-" || op == "/" || op == "%") && is(T : BigInt)) does not match any function template declaration test5.d(6): Error: template std.bigint.BigInt.opBinary(string op,T) if ((op == "+" || op == "*" || op == "-" || op == "/" || op == "%") && is(T : BigInt)) cannot deduce template function from argument types !("+")(int) test5.d(6): Error: template std.bigint.BigInt.__ctor(T : string) does not match any function template declaration test5.d(6): Error: template std.bigint.BigInt.__ctor(T : string) cannot deduce template function from argument types !()(_error_) This is due to the opBinary being non-const in std.bigint.
Comment #1 by bearophile_hugs — 2010-06-17T02:36:59Z
Dupe of bug 4301 ?
Comment #2 by clugdbug — 2010-06-17T04:02:50Z
*** This issue has been marked as a duplicate of issue 4301 ***