It's probably better to issue a warning than repeating the comment over and over in D.learn. So at least these two cases could issue a warning, but I guess there are more cases where the DMD frontend accepts a lot more than defined by the spec.
enum Z { one, two };
struct { int a = 1 };
http://forum.dlang.org/post/[email protected]
(In reply to greensunny12 from comment #0)
> but I
> guess there are more cases where the DMD frontend accepts a lot more than
> defined by the spec.
The spec recognizes those semicolons. They're empty 'DeclDef's as per <http://dlang.org/spec/module.html#DeclDef> (at the bottom of the list).
I'd suggest warning on every empty DeclDef and not only on those behind structs/enums.
Comment #3 by schveiguy — 2016-08-25T17:22:08Z
(In reply to ag0aep6g from comment #2)
> I'd suggest warning on every empty DeclDef and not only on those behind
> structs/enums.
for(;;)
Comment #4 by ag0aep6g — 2016-08-25T17:35:16Z
(In reply to Steven Schveighoffer from comment #3)
> (In reply to ag0aep6g from comment #2)
> > I'd suggest warning on every empty DeclDef and not only on those behind
> > structs/enums.
>
> for(;;)
According to <http://dlang.org/spec/statement.html#for-statement>, those semicolons are part of the 'for' syntax. That is, they're not empty 'DeclDef's (and they're not empty statements either). So they shouldn't be affected.
Comment #5 by cauterite — 2016-08-26T08:53:53Z
Since DMD already emits warning for empty statements, I would endorse warnings for empty declarations too, for the sake of consistency.
Comment #6 by b2.temp — 2016-08-26T09:48:00Z
libdparse already produces warnings for empty statements. While it does not reflect at 100% the D front-end, I think new warning could be added, especially since the author is a bit the assignee for all the grammar stuff.
About for(;;), still based on libdparse, ag0aep6g is right, there won't be any warning, that's another thing.
Comment #7 by b2.temp — 2016-08-26T09:48:39Z
*** Issue 16378 has been marked as a duplicate of this issue. ***
Comment #8 by b2.temp — 2016-08-26T10:01:06Z
(In reply to b2.temp from comment #6)
> libdparse already produces warnings for empty statements.
Oops, I meant that it does that for empty declarations, already, while DMD not yet !
Comment #9 by robert.schadek — 2024-12-13T18:49:45Z