Bug 21741 – std.format: %0*d produces int.max zeros

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-03-21T18:48:55Z
Last change time
2021-03-21T19:47:19Z
Assigned to
No Owner
Creator
Berni44

Comments

Comment #0 by bugzilla — 2021-03-21T18:48:55Z
Taken from https://issues.dlang.org/show_bug.cgi?id=15386: Not only the 'internal' ones, but also from public functions, this issue can be reproduced: void main() { import std.stdio; "%(%0*d%)".writefln(new int[1]); } I intended to specify equal width for each element of an array, put the width before new int[1] and got a runtime error. Removing the width from the arguments, I've come up with this code.
Comment #1 by bugzilla — 2021-03-21T19:47:19Z
I fear I've been over-hasty... It's indeed the same bug. *** This issue has been marked as a duplicate of issue 15386 ***