This gives an error:
class C(E...) : E[0]
{
}
Error: members expected
Error: { } expected following aggregate declaration
Inheriting from all the types in the type tuple is OK:
class C(E...) : E
{
}
Workaround:
template C(E...)
{
alias T = E[1..$];
class C : T
{
}
}
This seems somewhat similar to Issue 11581
Comment #1 by monarchdodra — 2013-11-22T13:47:32Z
(In reply to comment #0)
> This gives an error:
>
> class C(E...) : E[0]
> {
> }
>
> Error: members expected
> Error: { } expected following aggregate declaration
>
> ...
>
> Workaround:
Another one, which might be "cleaner" depending on how you are actually using E:
//----
class C(Base, E...) : Base
{}
//----
Comment #2 by k.hara.pg — 2013-11-22T22:16:30Z
(In reply to comment #0)
> This gives an error:
>
> class C(E...) : E[0]
> {
> }
>
> Error: members expected
> Error: { } expected following aggregate declaration
This is syntactic issue. Currently class declaration grammar is defined as follows:
----
ClassDeclaration:
class Identifier BaseClassListopt ClassBody
ClassTemplateDeclaration
BaseClassList:
: SuperClass
: SuperClass , Interfaces
: Interfaces
SuperClass:
Identifier
----
SuperClass should be Identifier, so it does not accept E[0].
Comment #3 by yebblies — 2013-11-23T00:27:41Z
Actually, parseBaseClasses uses parseBasicType. This was to include things like typeof.
class A {}
A a;
class B : typeof(a) {}