Bug 7080 – Chained BigInt.opAssign

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-12-08T04:27:00Z
Last change time
2012-07-16T23:39:10Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-12-08T04:27:56Z
For uniformity with normal integers I'd like this handy assignment to work: import std.bigint; void main() { BigInt x, y; x = y = 1; } But with dmd 2.057beta it gives: test.d(4): Error: template std.bigint.BigInt.opAssign(T : long) does not match any function template declaration test.d(4): Error: template std.bigint.BigInt.opAssign(T : long) cannot deduce template function from argument types !()(void) I think the problem is solved returning the input argument from both opAssign: /// T opAssign(T: long)(T x) { data = cast(ulong)((x < 0) ? -x : x); sign = (x < 0); return x; } /// T opAssign(T:BigInt)(T x) { data = x.data; sign = x.sign; return x; } See also bug 7079.
Comment #1 by clugdbug — 2012-07-16T23:39:10Z
*** This issue has been marked as a duplicate of issue 8165 ***