[Issue 21743] New: getOverloads fails to propagate 'this' expression for template member

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 21 20:53:46 UTC 2021


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 at puremagic.com
          Reporter: boris2.9 at 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");

--


More information about the Digitalmars-d-bugs mailing list