[Issue 21257] New: Template overload created by named imports passed via template alias to function in other module can't be instantiated

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 16 14:58:02 UTC 2020


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

          Issue ID: 21257
           Summary: Template overload created by named imports passed via
                    template alias to function in other module can't be
                    instantiated
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: default_357-line at yahoo.de

Consider the following two files:

```
--- test2.d
void act1(T : void)() { }
void act2(T : int)() { }
void call(alias fn, T)()
{
    alias instance = fn!T();
    instance(); // this works
    fn!T(); // this does not!
}
--- test.d
import test2 : act = act1, act = act2, call;
void main()
{
    act!int(); // this works
    act!void(); // this works, so act is an overload set
    call!(act, void); // but not this?
    call!(act, int); // and not this either!
}
```

https://run.dlang.io/is/gxaPuX

Even though we can call `act` in test with both supported types, we cannot call
it in `test2` with either. We get the error "none of the overloads of `act` are
callable using argument types `!(Struct)()` or "`!(int)()` respectively. If the
function is aliased beforehand, it works.

--


More information about the Digitalmars-d-bugs mailing list