template instance does not match template declaration

kdevel kdevel at vogtner.de
Fri Feb 25 23:05:00 UTC 2022


```
$ dmd --version
DMD64 D Compiler v2.098.1
[...]
```

```main.d
module main; // main.d
import std.traits;
import model;

void main ()
{
    enum Q = Parameters!read;
}
```

```model.d
module model; // model.d
import std.file : read; // this line provokes the error

int read (string filename)
{
    import std.file;
    auto data = std.file.read (filename);
    return 0;
}
```

```
$ dmd -i main
main.d(7): Error: template instance `model.Parameters!(read)` 
does not match template declaration `Parameters(func...)`
   with `func = (read)`
   must satisfy the following constraint:
`       isCallable!func`
```

It seems the template parameter f becomes not aliased to 
model.read in the presence of the selective import. Bug or 
feature?


More information about the Digitalmars-d-learn mailing list