Bug 15133 – Error message is incomprehensible

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-10-01T18:17:00Z
Last change time
2016-01-03T14:14:43Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
russel

Comments

Comment #0 by russel — 2015-10-01T18:17:21Z
The code: import std.algorithm: reduce; int do_stuff(int[] data) { return reduce!"a + b"(data); } void main() { do_stuff([]); } results in the error message below when run with rdmd 20150923 (dmd 2.068.2). The error message may mean something to the maintainer of the internal implementation of std.algorithm.reduce, but the the D programmer it is incomprehensible. The actual error message should relate to this version of reduce not being able to deal with empty data set, that the: reduce!"a + b"(0, data) form is required to cover that situation. object.Exception@/usr/include/dmd/phobos/std/algorithm/iteration.d(2477): Enforcement failed ---------------- /tmp/.rdmd-1000/rdmd-reduce_message_problem.d-C44863E4986E9DF493BA22F7E5752792/reduce_message_problem(pure @safe bool std.exception.enforce!(Exception, bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong)+0x65) [0x4289dd] /tmp/.rdmd-1000/rdmd-reduce_message_problem.d-C44863E4986E9DF493BA22F7E5752792/reduce_message_problem(pure @safe int std.algorithm.iteration.reduce!("a + b").reduce!(int[]).reduce(int[])+0x4c) [0x428824] /tmp/.rdmd-1000/rdmd-reduce_message_problem.d-C44863E4986E9DF493BA22F7E5752792/reduce_message_problem(int reduce_message_problem.do_stuff(int[])+0x20) [0x4287a8] /tmp/.rdmd-1000/rdmd-reduce_message_problem.d-C44863E4986E9DF493BA22F7E5752792/reduce_message_problem(_Dmain+0x1d) [0x4287cd] /tmp/.rdmd-1000/rdmd-reduce_message_problem.d-C44863E4986E9DF493BA22F7E5752792/reduce_message_problem(_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv+0x1f) [0x42c623] /tmp/.rdmd-1000/rdmd-reduce_message_problem.d-C44863E4986E9DF493BA22F7E5752792/reduce_message_problem(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x2a) [0x42c57e] /tmp/.rdmd-1000/rdmd-reduce_message_problem.d-C44863E4986E9DF493BA22F7E5752792/reduce_message_problem(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()+0x2b) [0x42c5df] /tmp/.rdmd-1000/rdmd-reduce_message_problem.d-C44863E4986E9DF493BA22F7E5752792/reduce_message_problem(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x2a) [0x42c57e] /tmp/.rdmd-1000/rdmd-reduce_message_problem.d-C44863E4986E9DF493BA22F7E5752792/reduce_message_problem(_d_run_main+0x1d2) [0x42c4fe] /tmp/.rdmd-1000/rdmd-reduce_message_problem.d-C44863E4986E9DF493BA22F7E5752792/reduce_message_problem(main+0x12) [0x428d1a] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7ff78b82cb45]
Comment #1 by dlang-bugzilla — 2015-10-15T18:47:15Z
Comment #2 by github-bugzilla — 2015-10-15T19:28:34Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/91b34d9c70dd25f152f4cac9628e99022a3342fd fix Issue 15133 - Error message is incomprehensible https://github.com/D-Programming-Language/phobos/commit/758e6f2f9edd77e0333d188f73debb846c18cf88 Merge pull request #3723 from CyberShadow/pull-20151015-184625 fix Issue 15133 - Error message is incomprehensible
Comment #3 by github-bugzilla — 2016-01-03T14:14:43Z