[Issue 21491] New: Can't enumerate overload set from mixin templates

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 19 10:24:13 UTC 2020


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

          Issue ID: 21491
           Summary: Can't enumerate overload set from mixin templates
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dlang-bugzilla at thecybershadow.net

If functions with the same name across several mixed-in mixin templates create
an overload set, it is invisible to getOverloads:

///////////////////////// test.d /////////////////////////
struct A
{
    void ov(int){}
    void ov(string){}
}

struct B
{
    mixin template M()
    {
        void ov(int){}
        void ov(string){}
    }
    mixin M;
}

struct C
{
    mixin template M(T)
    {
        void ov(T){}
    }
    mixin M!int;
    mixin M!string;
}

pragma(msg, __traits(getOverloads, A, q{ov})); // OK
pragma(msg, __traits(getOverloads, B, q{ov})); // OK
pragma(msg, __traits(getOverloads, C, q{ov})); // nothing?
//////////////////////////////////////////////////////////

This is despite that the functions otherwise act like an overload set, i.e.:

C c; c.ov(1); c.ov("2");

works as expected.

--


More information about the Digitalmars-d-bugs mailing list