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