Bug 15297 – std.stdio readf cryptic error message

Status
RESOLVED
Resolution
DUPLICATE
Severity
minor
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2015-11-06T14:41:00Z
Last change time
2017-07-18T13:04:00Z
Assigned to
nobody
Creator
pastuhov85

Comments

Comment #0 by pastuhov85 — 2015-11-06T14:41:39Z
Consider this small example: import std.stdio; void main() { int a; readf("%s", &a); writeln("a now is ", a); } If we compile and run it and then feed it some wrong (non-integer) input, program crashes and error message looks like this: std.conv.ConvException@/usr/include/dmd/phobos/std/conv.d(1998): Unexpected ' ' when converting from type LockingTextReader to type int ---------------- ??:? int std.conv.parse!(int, std.stdio.LockingTextReader).parse(ref std.stdio.LockingTextReader) [0x440857] ??:? int std.conv.parse!(int, std.stdio.LockingTextReader).parse(ref std.stdio.LockingTextReader, uint) [0x440567] ??:? int std.format.unformatValue!(int, std.stdio.LockingTextReader, char).unformatValue(ref std.stdio.LockingTextReader, ref std.format.FormatSpec!(char).FormatSpec) [0x43fdc2] ??:? uint std.format.formattedRead!(std.stdio.LockingTextReader, char, int*).formattedRead(ref std.stdio.LockingTextReader, const(char)[], int*) [0x43cdd7] ??:? uint std.stdio.File.readf!(int*).readf(const(char[]), int*) [0x43cd32] ??:? uint std.stdio.readf!(int*).readf(const(char[]), int*) [0x43cc67] ??:? _Dmain [0x43cc27] ??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x448aca] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x448a20] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x448a86] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x448a20] ??:? _d_run_main [0x44897d] ??:? main [0x444695] ??:? __libc_start_main [0x2b01360f] It's weird and absolutely uninformative. I suppose question marks (?) are meant to be row:column numbers?
Comment #1 by dlang-bugzilla — 2017-07-18T13:04:00Z
*** This issue has been marked as a duplicate of issue 12260 ***