www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17288] New: formattedWrite error when width/precision

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 puremagic.com
          Reporter: nick 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.

--
Mar 30