Bug 10234 – Class declaration grammar seems to be incorrect

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-01T20:08:00Z
Last change time
2015-06-09T05:15:16Z
Keywords
spec
Assigned to
nobody
Creator
briancschott
Blocks
10233

Comments

Comment #0 by briancschott — 2013-06-01T20:08:05Z
The class declaration grammar defines a base class list in terms of a comma-separated list of identifiers, but this disallows the following: class SomeClass : other.mod.BaseClass { // stuff goes here... } I've looked in dmd's source code and found that each item in the base class list is actually a BasicType. This doesn't make very much sense. It seems that both the compiler and the specification are wrong here.
Comment #1 by default_357-line — 2013-06-01T20:16:08Z
Another case would be class SomeClass : SomeTemplate!(SomeType) { }. I'm not sure if there's a way in the parser to describe "any type specification that could conceivably be a class or interface". In that light, DMD's behavior might make more sense.
Comment #2 by yebblies — 2013-08-17T21:08:46Z
dmd's parser is correct here. The ability to receive almost any type was added to satisfy bug 1353 and bug 8513 - any non-class types are rejected during semantic instead. This has the side effect of making error messages much better if anybody _did_ try to make a class inherit from 'int'. So this is purely a spec bug.
Comment #3 by k.hara.pg — 2014-09-22T01:46:55Z
*** This issue has been marked as a duplicate of issue 13448 ***