template with enum parameter doesn't compile

Sjoerd Nijboer dlang at sjoerdnijboer.com
Fri Apr 5 14:47:42 UTC 2019


So the following code doesn't compile for some reason, and I 
can't figure out why.

enum MyEnum { A, B, C }

class MyClass(MyEnum myEnum)
{
     /*...*/
}

int main()
{
	MyClass!MyEnum.A a;
}

The error:  Error: template instance `MyClass!(MyEnum)` does not 
match template declaration `MyClass(MyEnum myEnum)`
pops up, no matter what I do.
I'm quite puzzled actually


More information about the Digitalmars-d-learn mailing list