[Issue 13895] New: Declaration grammar is insufficient

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Dec 26 00:45:33 PST 2014


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: nobody at puremagic.com
          Reporter: briancschott at 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.

--


More information about the Digitalmars-d-bugs mailing list