The following test program, compiled with "-boundscheck=off", writes int.max (2147483647): ----- import std.bigint, std.stdio; void main () { auto a = BigInt (""); int x = a.toInt (); writeln (x); } ----- With bounds checking enabled, it fails on line 57 of bigint.d for accessing element 0 of an empty array: core.exception.RangeError@std\bigint.d(57): Range violation The error when converting an empty string to a BigInt should be raised regardless of whether bounds checking is on.
https://github.com/D-Programming-Language/phobos/pull/3995
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/3ad0489e36819780a5b9c8a486968f6ae2fe73d3 Merge pull request #3995 from quickfur/bigint_bounds Issue 15678: BigInt("") should not break array bounds
Commit pushed to revert-3995-bigint_bounds at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/181ea47be7885ad02c7030b4c6b3c3253d8f2223 Revert "Issue 15678: BigInt("") should not break array bounds"
The bot didn't auto close this one, maybe "fixed" or "fix" missed in the PR title.