Error: template instance does not match template declaration
Tejas
notrealemail at gmail.com
Wed Nov 17 12:19:05 UTC 2021
On Wednesday, 17 November 2021 at 10:10:43 UTC, Vitalii wrote:
> Hello! I am getting the following error:
> ```
> inst.d(8): Error: template instance `Worker!(Mode.Inspect)`
> does not match template declaration `Worker(mode : Mode)
> ```
>
> when compile next code:
> ```
> enum Mode { Inspect, Execute }
>
> class Worker(mode : Mode) {
> this() {}
> }
>
> void main() {
> auto W = Worker!(Mode.Inspect)();
> }
> ```
> Can anybody suggest to me what I do wrong?
```d
enum Mode { Inspect, Execute }
class Worker(Mode /*no need for template specialization :) */a) {
this() {}
}
void main() {
auto W = new/*Add new here, because this ais a class, not
struct*/ Worker!(Mode.Inspect)();
}
More information about the Digitalmars-d-learn
mailing list