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.
Comment #2 by thomas-dloop — 2006-11-23T04:57:37Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-11-05: > http://d.puremagic.com/issues/show_bug.cgi?id=480 > Error generated by the line of code: > int arr[1] = [1,2,3,4,5,6,7]; > doesn't give the line number. test cases: http://dstress.kuehne.cn/nocompile/a/array_initialization_18_A.d http://dstress.kuehne.cn/nocompile/a/array_initialization_18_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFZYMNLK5blCcjpWoRAqHzAJ0bFJdBIF6GH85A1zfmfoZsCmnFHQCfXiEb 6w3L32pAaQ77IsGKgkazr/s= =CY1+ -----END PGP SIGNATURE-----
Comment #3 by bugzilla — 2006-11-25T04:02:29Z
Fixed DMD 0.175