[Issue 22824] New: alias template parameter bound to wrong symbol (Error: template instance does not match template declaration)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 25 23:52:57 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=22824

          Issue ID: 22824
           Summary: alias template parameter bound to wrong symbol (Error:
                    template instance does not match template declaration)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: kdevel at vogtner.de

```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;
}
```

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

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

$ 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`

As explained in [1] the template parameter is bound to std.file.read instead of
module.read.

[1] http://forum.dlang.org/thread/htnakhxqoxqeduzzgdbl@forum.dlang.org
    template instance does not match template declaration

--


More information about the Digitalmars-d-bugs mailing list