Bug 3851 – Array copy error message with no line number

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-02-24T08:19:00Z
Last change time
2015-06-09T01:27:39Z
Assigned to
andrej.mitrovich
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-02-24T08:19:51Z
This code: void main() { auto a1 = new int[5]; auto a2 = new int[4]; a1[] = a2; } Produces an error at runtime that doesn't show the line number (and file name): object.Exception: lengths don't match for array copy
Comment #1 by bearophile_hugs — 2010-03-11T13:26:09Z
Suggestion from Steven Schveighoffer: once a stacktrace printout is available, probably there is no need to instrument code like this to show line numbers.
Comment #2 by andrej.mitrovich — 2012-10-21T20:07:44Z
I can't help you with lines (it would probably kill performance), but druntime already had some code to deal with mismatching lengths. It printed mismatched lengths for array assigns but not for copies (and also it printed invalid lengths due to relying on specific expression evaluation). I'm fixing this now.
Comment #3 by github-bugzilla — 2012-10-22T05:45:28Z
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/646f9c84320beb697baf0f13c5b12a28afd4dcc3 Fixes Issue 3851 - Print mismatching lengths for both assignments and copies. https://github.com/D-Programming-Language/druntime/commit/594613c5f028fca4778f682d02c568cac3e7ee73 Merge pull request #332 from AndrejMitrovic/Fix3851 Fix Issue 3851 - Array copy error message