When compiled by dmd with debug information, stepping through the following code in a debugger enum { Success, Failure } int main() { return Success; } makes the debugger jump to the enumerator declaration when the instruction pointer is in fact at the return statement. This can be very annoying because there is no information of the actual line of execution, you have to guess from the disassembly. This is happening because the line info is taken from the first expression of the return statement, which is the initializer expression of the enum identifier. I suggest forcing the line number to the statement instead. *** src\s2ir.c 2011-02-14 19:56:09.000000000 +-0100 --- src\s2ir.c 2011-02-07 01:49:13.000000000 +-0100 *************** *** 1287,1298 **** --- 1287,1299 ---- else { e = exp->toElem(irs); assert(e); } + elem_setLoc(e, loc); block_appendexp(blx->curblock, e); block_next(blx, BCretexp, NULL); } else block_next(blx, BCret, NULL); } This is under Windows, but I guess it also applies to other OS supported by dmd.
https://github.com/D-Programming-Language/dmd/pull/258
https://github.com/D-Programming-Language/dmd/commit/80456938e2302c36de54809af0f171d3becd8840 https://github.com/D-Programming-Language/dmd/commit/17daa94d2137a30cc8f81cc08b28d254c3555204