[Issue 18947] No way to get list of overloads from template mixins

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 13 03:43:24 UTC 2019


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

Basile-z <b2.temp at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |b2.temp at gmx.com
           Hardware|x86                         |All
         Resolution|---                         |INVALID
                 OS|Windows                     |All

--- Comment #1 from Basile-z <b2.temp at gmx.com> ---
Mixed declarations are put in a nested scope. To get the overload set it's
possible to use aliases to this nested scopes:

mixin template foo(T) {
    void fun(T) {}
}

struct S {
    mixin foo!int o1;
    mixin foo!string o2;
    alias fun = o1.fun;
    alias fun = o2.fun;
}

unittest {
    static assert(__traits(getOverloads, S, "fun").length == 2);
}

see point 5 of https://dlang.org/spec/template-mixin.html#mixin_scope

--


More information about the Digitalmars-d-bugs mailing list