Template instance does not match template declaration

Marc mailnawman at gmail.com
Fri Aug 15 12:02:19 UTC 2025


Hello,
I'm trying to declare a templated member function that takes a 
value of size_t N. A simple example to reproduce what Im trying 
to do is the following:

```d
import std.stdio;
void getCol(N: size_t)() {
    return N;
}

void main() {
    // Call
    writeln(getCol!0());
}
```
I get the following error: `Error: template instance `getCol!0` 
does not match template declaration `getCol(N : ulong)()`
    writeln(getCol!0());
            ^
Error dmd failed with exit code 1.`

Can anyone please help me getting it to work?


More information about the Digitalmars-d-learn mailing list