Bug 480 – too many initializers error message doesn't give line number
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2006-11-04T23:34:00Z
Last change time
2014-02-15T13:18:42Z
Keywords
diagnostic
Assigned to
bugzilla
Creator
wbaxter
Comments
Comment #0 by wbaxter — 2006-11-04T23:34:53Z
Error generated by the line of code:
int arr[1] = [1,2,3,4,5,6,7];
doesn't give the line number.
There seem to be two such messages in src/DMD/todt.c:
todt.c:243: error("too many initializers %d for array[%d]", dim, tadim);
todt.c:346: error("too many initializers %d for array[%d]", dim, tadim);
Also the text of the message needs some commas, like
error(loc, "too many initializers, %d, for array[%d]", dim, tadim);
This makes it difficult to use the compiler error messages as a way to determine the proper size for static arrays.
Comment #1 by wbaxter — 2006-11-04T23:56:20Z
Also these error messages are treated as fatal, when I don't think they need to be. I.e. as soon as you get one such message the compiler gives up. This also makes it more difficult than necessary to use the compiler error messages as a way to count the length. It means you have to fix one - recompile - fix one - recompile - etc one by one until you have the lengths for all your arrays.