[Issue 15348] New: std.stdio.writef format specifier error message

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Nov 16 15:25:33 PST 2015


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

          Issue ID: 15348
           Summary: std.stdio.writef format specifier error message
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: rmaicle at gmail.com

The code below throws a FormatException but reports an error from the library
source instead of reporting the error from the offending line in the user
program. Also, a more informative error message would help.

import std.stdio;

void main()
{
    writef("%*10d", 100);
}

std.format.FormatException at std/format.d(978): $ expected
----------------
??:? pure @safe bool
std.exception.enforceEx!(std.format.FormatException).enforceEx!(bool).enforceEx(bool,
lazy immutable(char)[], immutable(char)[], ulong) [0x43773e]
??:? pure @safe void std.format.FormatSpec!(char).FormatSpec.fillUp()
[0x447503]
??:? @safe bool
std.format.FormatSpec!(char).FormatSpec.writeUpToNextSpec!(std.stdio.File.LockingTextWriter).writeUpToNextSpec(std.stdio.File.LockingTextWriter)
[0x43812b]
??:? @safe uint std.format.formattedWrite!(std.stdio.File.LockingTextWriter,
char, int).formattedWrite(std.stdio.File.LockingTextWriter, const(char[]), int)
[0x436f51]
??:? @safe void std.stdio.File.writef!(char, int).writef(const(char[]), int)
[0x436e87]
??:? @safe void std.stdio.writef!(immutable(char)[],
int).writef(immutable(char)[], int) [0x436deb]
??:? _Dmain [0x436d9f]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x443c7a]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate()) [0x443bd0]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).runAll() [0x443c36]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate()) [0x443bd0]
??:? _d_run_main [0x443b2d]
??:? main [0x43f88d]
??:? __libc_start_main [0x7a34460f]


===============
Additional Info

DMD64 D Compiler v2.069
Linux sphere-0 4.1.12-1-MANJARO #1 SMP PREEMPT Tue Oct 27 22:11:47 UTC 2015
x86_64 GNU/Linux

--


More information about the Digitalmars-d-bugs mailing list