[Issue 17288] New: formattedWrite error when width/precision provided and no value to format

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Mar 30 09:43:31 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17288

          Issue ID: 17288
           Summary: formattedWrite error when width/precision provided and
                    no value to format
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: minor
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: nick at geany.org

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.

--


More information about the Digitalmars-d-bugs mailing list