Can't seem to call super constructor if it's a template

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Wed Aug 12 06:22:07 UTC 2020


On Monday, 10 August 2020 at 18:37:06 UTC, Andrei Alexandrescu 
wrote:
> class A {
>     this(T)() {}
> }
>
> class B : A {
>     this() { super!int(); }
> }
>
> Error: found ! when expecting ; following statement
>
> That should work, shouldn't it?

It is not possible to call cobstructors with explicit template 
parameters. There was documentation note about that from what I 
remember, though for some reason I can't find yet.

Reason for that may be the case where you have templated class 
with templated constructor. How would user pass template args to 
class itself and then to constructor?


More information about the Digitalmars-d mailing list