www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15133] New: Error message is incomprehensible

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

          Issue ID: 15133
           Summary: Error message is incomprehensible
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: russel winder.org.uk

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]

--
Oct 01 2015