www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21257] New: Template overload created by named imports passed


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


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.

Sep 16 2020