Bug 8167 – BigInt(BigInt(1)) too

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-05-30T05:15:00Z
Last change time
2014-02-05T17:21:14Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-05-30T05:15:59Z
I think there's no need to refuse this code: import std.bigint: BigInt; void main() { auto b1 = BigInt(1); auto b2 = BigInt(b1); } DMD 2.060alpha gives: test.d(4): Error: template std.bigint.BigInt.__ctor does not match any function template declaration ...\dmd2\src\phobos\std\bigint.d(82): Error: template std.bigint.BigInt.__ctor cannot deduce template function from argument types !()(BigInt) Currently BigInt contains immutable digits, so that operation is O(1). GMP supports mutable numbers too for higher efficiency for certain operations, if BigInt will do the same, then BigInt(BigInt(1)) will create a copy of the digits.
Comment #1 by simen.kjaras — 2013-11-25T16:45:28Z
Comment #2 by safety0ff.bugz — 2014-02-05T17:21:14Z