Thread overview
[Issue 480] New: too many initializers error message doesn't give line number
Nov 05, 2006
d-bugmail
Nov 05, 2006
d-bugmail
Nov 23, 2006
Thomas Kuehne
Nov 25, 2006
d-bugmail
November 05, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=480

           Summary: too many initializers error message doesn't give line
                    number
           Product: D
           Version: 0.172
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: wbaxter@gmail.com


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.


-- 

November 05, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=480





------- Comment #1 from wbaxter@gmail.com  2006-11-04 23:56 -------
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.


-- 

November 23, 2006
d-bugmail@puremagic.com 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


November 25, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=480


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #3 from bugzilla@digitalmars.com  2006-11-25 04:02 -------
Fixed DMD 0.175


--