[Issue 13448] New: Class specification misses template classes in base classes list
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Sep 9 10:36:30 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13448
Issue ID: 13448
Summary: Class specification misses template classes in base
classes list
Product: D
Version: D2
Hardware: All
URL: http://dlang.org/class.html#ClassDeclaration
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: websites
Assignee: nobody at puremagic.com
Reporter: s.trump at gmail.com
Blocks: 10233
(http://dlang.org/class.html#ClassDeclaration) says after ':' there is a list
of base classes. But "BaseClassList" rule allows only 'Identifier' separated
with comma. 'TemplateInstance' rule must be added.
Let's open sample code from http://dlang.org/template.html
> interface Addable(T)
> {
> final R add(this R)(T t)
> {
> return cast(R)this; // cast is necessary, but safe
> }
> }
>
> class List(T) : Addable!T
> {
> List remove(T t)
> {
> return this;
> }
> }
>
> void main()
> {
> auto list = new List!int;
> list.add(1).remove(1); // ok
> }
I want to pay attention at line 9:
> class List(T) : Addable!T
"Addable!T" doesn't fit rule 'BaseClassList'.
This sample code is compiled by DMD2 compiler (but interface must be replaced
with class previously). So I think specification must be updated in
"SuperClass" and "Interface" rules.
> SuperClass:
> Identifier
> TemplateInstance
>
> Interface:
> Identifier
> TemplateInstance
--
More information about the Digitalmars-d-bugs
mailing list