www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21743] New: getOverloads fails to propagate 'this' expression

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

          Issue ID: 21743
           Summary: getOverloads fails to propagate 'this' expression for
                    template member
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: boris2.9 gmail.com

struct A
{ 
    int foo(int a) { return a; }
    string foo()(string b) { return b; }
}

alias ov = __traits(getOverloads, A.init, "foo", true);

// member function works
static assert(ov[0](1) == 1);

// member template fails, gagged error:
// 'need this for foo of type pure nothrow  nogc  safe string(string b)'
static assert(ov[1]("a") == "a");

--
Mar 21 2021