D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2651 - class body declaration grammar incorrect
Summary: class body declaration grammar incorrect
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL: http://www.digitalmars.com/d/2.0/clas...
Keywords: spec
Depends on:
Blocks: 2652
  Show dependency treegraph
 
Reported: 2009-02-08 21:55 UTC by Jerry Quinn
Modified: 2015-06-09 01:21 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jerry Quinn 2009-02-08 21:55:57 UTC
The published class grammar looks like:

ClassBodyDeclaration:
	Declaration
	Constructor
	Destructor
	StaticConstructor
	StaticDestructor
	Invariant
	UnitTest
	ClassAllocator
	ClassDeallocator

However, the Declaration grammar doesn't permit a construct such as

synchronized ~this () {}

  or

const {
  void fn1 () {}
  void fn2 () {}
}

The rest of the docs clearly expect this kind of construction to be allowed.  I believe the fix is to modify the class body grammar to:

ClassBodyDeclaration:
   	DeclDef               <-- this is the change
	Constructor
	Destructor
	StaticConstructor
	StaticDestructor
	Invariant
	UnitTest
	ClassAllocator
	ClassDeallocator