Bug 17288 – formattedWrite error when width/precision provided and no value to format

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2017-03-30T16:43:31Z
Last change time
2018-01-05T13:28:03Z
Assigned to
No Owner
Creator
Nick Treleaven

Comments

Comment #0 by nick — 2017-03-30T16:43:31Z
The following calls have a missing integer, the first is used for precision (same happens for %*.d width too): import std.format; unittest { enum f = format("%.*d", 5); // Compile error: "n = 1" auto s = format("%.*d", 5); // throws RangeError } Instead, format should throw FormatError. PR to follow.
Comment #1 by github-bugzilla — 2017-04-03T17:17:01Z
Commit pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/b09ad9aeeaed177ca1fa2721d36064b4c00d3fe6 Fix Issue 17288 - formattedWrite with width/precision and no value Previously an RangeError at runtime or assert(0) at CT would fire from formatNth with message e.g. "n = 1".
Comment #2 by github-bugzilla — 2017-06-17T11:34:15Z
Commit pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/b09ad9aeeaed177ca1fa2721d36064b4c00d3fe6 Fix Issue 17288 - formattedWrite with width/precision and no value
Comment #3 by github-bugzilla — 2017-08-07T12:26:38Z
Commit pushed to newCTFE at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/b09ad9aeeaed177ca1fa2721d36064b4c00d3fe6 Fix Issue 17288 - formattedWrite with width/precision and no value
Comment #4 by github-bugzilla — 2018-01-05T13:28:03Z
Commit pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/b09ad9aeeaed177ca1fa2721d36064b4c00d3fe6 Fix Issue 17288 - formattedWrite with width/precision and no value