https://issues.dlang.org/show_bug.cgi?id=13895

          Issue ID: 13895
           Summary: Declaration grammar is insufficient
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nob...@puremagic.com
          Reporter: briancsch...@gmail.com
            Blocks: 10233

Consider the following code (which is accepted by DMD):

---
void main()
{
    abstract class C {}
}
---

This produces the parse tree:

...
    NonEmptyStatementNoCaseNoDefault
        DeclarationStatement
            Declaration
                ???
                    AggregateDeclaration
                        ClassDeclaration
                            ....

The problem is that there is no grammar rule stating that "abstract" is valid
at that location, though it obviously is and should be.

Adding "StorageClasses(opt)" to AggregateDeclaration, or to ClassDeclaration,
InterfaceDeclaration, StructDeclaration, and UnionDeclaration should fix this.

--

Reply via email to