[Issue 21836] New: std.format: grouping may cause RangeError

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 17 08:48:37 UTC 2021


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

          Issue ID: 21836
           Summary: std.format: grouping may cause RangeError
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at bernis-buecher.de

assert(format!"%-5,1g"(0.0) == "0    ");

Instead it throws:

core.exception.RangeError@/usr/include/dmd/phobos/std/format/internal/write.d(656):
Range violation
----------------
??:? _d_arrayboundsp [0x563fc0971eed]
??:? @safe void
std.format.internal.write.formatValueImpl!(std.stdio.File.LockingTextWriter,
double, char).formatValueImpl(ref std.stdio.File.LockingTextWriter, double,
scope ref const(std.format.spec.FormatSpec!(char).FormatSpec)) [0x563fc09678a8]
??:? @safe void std.format.write.formatValue!(std.stdio.File.LockingTextWriter,
double, char).formatValue(ref std.stdio.File.LockingTextWriter, ref double,
scope ref const(std.format.spec.FormatSpec!(char).FormatSpec)) [0x563fc0967107]
??:? @safe uint
std.format.write.formattedWrite!(std.stdio.File.LockingTextWriter, char,
double).formattedWrite(ref std.stdio.File.LockingTextWriter, scope
const(char[]), double) [0x563fc0966270]
??:? @safe void std.stdio.File.writefln!(char, double).writefln(in char[],
double) [0x563fc0965ef2]
??:? @safe void std.stdio.writefln!(char, double).writefln(in char[], double)
[0x563fc0965e7a]
??:? @safe void std.stdio.writefln!("%-5,1g", double).writefln(double)
[0x563fc09523cf]
??:? _Dmain [0x563fc0951b8f]

--


More information about the Digitalmars-d-bugs mailing list