D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4340 - Arithmetic impossible with const BigInt
Summary: Arithmetic impossible with const BigInt
Status: RESOLVED DUPLICATE of issue 4301
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-17 02:12 UTC by Pelle Månsson
Modified: 2010-06-17 04:02 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Pelle Månsson 2010-06-17 02:12:02 UTC
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 bearophile_hugs 2010-06-17 02:36:59 UTC
Dupe of bug 4301 ?
Comment 2 Don 2010-06-17 04:02:50 UTC

*** This issue has been marked as a duplicate of issue 4301 ***