http://d.puremagic.com/issues/show_bug.cgi?id=2477
Summary: Trailing comma in array literal sometimes accepted,
sometimes not
Product: D
Version: 1.037
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]
void main() {
int[] data = [1,2,3,]; // OK
data = [ 1,2,3, ]; // fails
/+
// error messages
trailcomma.d(20): found ';' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
trailcomma.d(29): found 'EOF' when expecting ','
+/
}
The repetition of the EOF error message 20 times is also rather odd.
I don't know if trailing comma is spec'ed as being allowed or not (I much
prefer allowing it), but either way it should be consistent.
--