[Issue 23482] New: "template instance is not a template declaration, it is a function alias" when template is in a different module

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 13 17:30:54 UTC 2022


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

          Issue ID: 23482
           Summary: "template instance is not a template declaration, it
                    is a function alias" when template is in a different
                    module
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: andy.pj.hanson at gmail.com

This requires two files to reproduce.

a.d:
```
import b : foo;

void foo(char) {}

void main() {
        foo!"a"(1);
}
```

b.d:
```
module b;

void foo(int[]) {}
void foo(string s)(int) {}
```

The error is:
```
a.d(6): Error: template instance `foo!"a"` `foo` is not a template declaration,
it is a function alias
```


There is no error if I remove either `void foo(char) {}` or `void foo(int[])
{}`. There is also no error if I move the contents of `b.d` into `a.d`.

--


More information about the Digitalmars-d-bugs mailing list