digitalmars.D.bugs - [Issue 16661] New: std/format.d(1070): Incorrect format specifier:
- via Digitalmars-d-bugs (64/64) Nov 04 2016 https://issues.dlang.org/show_bug.cgi?id=16661
https://issues.dlang.org/show_bug.cgi?id=16661 Issue ID: 16661 Summary: std/format.d(1070): Incorrect format specifier: .2f for wstring and dstring Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: regression Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: ttanjo gmail.com I reproduced it on Linux 64bit systems. The following code throws an exception at runtime when using dmd 2.072.0 or later. When I use older version of dmd, this code run without exceptions. === sample.d void main(string[] args) { import std.format; assert(format("%.2f"d, 0.4) == "0.40"); } === How to reproduce: === $ dmd sample.d $ ./sample === Expected: ./sample successfully exits without any outputs. Actual: ./sample shows the following message: ========= object.Exception /home/tomoya/.denv/versions/dmd-trunk/linux/bin64/../../src/phobos/std/format.d(1070): Incorrect format specifier: .2f ---------------- ??:? pure safe void std.format.FormatSpec!(dchar).FormatSpec.fillUp() [0x43e24e] ??:? pure safe bool std.format.FormatSpec!(dchar).FormatSpec.writeUpToNextSpec!(std.array.Appender!(immutable(dchar)[]).Appender).writeUpToNextSpec(std.array.Appender!(immutable(dchar)[]).Appender) [0x440487] ??:? safe uint std.format.formattedWrite!(std.array.Appender!(immutable(dchar)[]).Appender, dchar, double).formattedWrite(std.array.Appender!(immutable(dchar)[]).Appender, const(dchar[]), double) [0x43cc67] ??:? safe immutable(dchar)[] std.format.format!(dchar, double).format(const(dchar[]), double) [0x43c6c6] ??:? _Dmain [0x43c64a] ??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x44c4b2] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x44c3f8] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x44c46e] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x44c3f8] ??:? _d_run_main [0x44c372] ??:? main [0x44a06d] ??:? __libc_start_main [0x535b0290] ========= When I use "%.2f" instead of "%.2f"d, it runs without exceptions. When I use "%.2f"w or "%.2f"d, it throws an exception. --
Nov 04 2016