Bug 10278 – Pre-condition failure blame error message to improve debugging

Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-05T17:16:18Z
Last change time
2021-05-11T09:12:26Z
Keywords
diagnostic
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-06-05T17:16:18Z
int foo(int x) in { assert(x >= 0); // line 3. } body { return x ^^ 2; } void main() { foo(-1); // line 8. } With DMD 2.064alpha it gives at run-time: core.exception.AssertError@temp(3): Assertion failure followed by the stack trace. To speed up my debugging I suggest to instead generate two error messages similar to (the second line is the same as before): temp.d(8): Pre-condition violation: x >= 0 (x = -1) core.exception.AssertError@temp(3): Assertion failure
Comment #1 by razvan.nitu1305 — 2021-05-11T09:12:26Z
This seems to add little benefit as the stack trace contains the line numbers.