[Issue 2477] Trailing comma in array literal sometimes accepted, sometimes not

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 17 18:24:48 PDT 2009


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


Brian Kropf <brian.kropf at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |brian.kropf at gmail.com




--- Comment #3 from Brian Kropf <brian.kropf at gmail.com>  2009-07-17 18:24:47 PDT ---
I'd originally submitted this on the ldc bugtracker and got forwarded here
(since it is using the dmd front-end).  Here's a bit more info on the issue:

When using sabledd generated code, I'm seeing an error with ldc that was not
present when I used gdc. It boils down to ldc not accepting only part of the
endings of array initializers having commas. The following minimal test case
does not build successfully on ldc x64 (but it will if you add a comma to the
end of the second array initializer (like '[ 4, 5, 6, ],'). Curiously enough it
also builds cleanly if I remove the commas after the 3 and the 6 in the
example.

test.d: int arr[][] = [
    [ 1, 2, 3, ], [ 4, 5, 6, ]
];

int main(char[][] args) {
    return 0;
}

Error output:

test.d(7): expression expected, not ']' test.d(7): comma expected separating
array initializers, not ; test.d(9): semicolon expected, not 'int' Error:
Command failed, aborting.

-- 
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