[Issue 3854] New: Error on static initialization of arrays with trailing comma.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 25 12:16:40 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3854

           Summary: Error on static initialization of arrays with trailing
                    comma.
           Product: D
           Version: 1.056
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: sky at q1cc.net


--- Comment #0 from Markus Dangl <sky at q1cc.net> 2010-02-25 12:16:37 PST ---
The following code worked in DMD 1.045, but not with 1.056 and i think it
should:
uint[][] b = [[ 1, 2, ]];
The following code always works, which is odd:
uint[] a = [ 1, 2, ];
I assume it is a minor parser bug.

Workaround:
Omit the last comma.

Here is the full code i used:
module main;
int main(char[][] args) {
    uint[][] b = [[ 1, 2, ]];
    return 0;
}

And the output of "dmd main.d":
main.d(3): expression expected, not ']'
main.d(3): comma expected separating array initializers, not ;
main.d(4): semicolon expected, not 'return'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list