www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 480] New: too many initializers error message doesn't give line number

reply d-bugmail puremagic.com writes:
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.


-- 
Nov 04 2006
next sibling parent d-bugmail puremagic.com writes:
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.


-- 
Nov 04 2006
prev sibling next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- iD8DBQFFZYMNLK5blCcjpWoRAqHzAJ0bFJdBIF6GH85A1zfmfoZsCmnFHQCfXiEb 6w3L32pAaQ77IsGKgkazr/s= =CY1+ -----END PGP SIGNATURE-----
Nov 23 2006
prev sibling parent d-bugmail puremagic.com writes:
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


-- 
Nov 25 2006