www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21058] New: __traits(getOverloads) forgets with with third

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

          Issue ID: 21058
           Summary: __traits(getOverloads) forgets with with third
                    argument or if first overload is a template
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: rmanth gmail.com

struct A {
    int foo(string s) { return 0; }
}

static assert(__traits(getOverloads, A.init, "foo")[0]("hi") == 0); // works
static assert(__traits(getOverloads, A.init, "foo", true)[0]("hi") == 0); //
Error: need this for foo of type int(string s)

struct B {
    int foo()(int i) { return 1; }
    int foo(string s) { return 0; }
}

static assert(__traits(getOverloads, B.init, "foo")[0]("hi") == 0); // Error:
need this for foo of type int(string s)
static assert(__traits(getOverloads, B.init, "foo", true)[0]("hi") == 0); //
Error: need this for foo of type int(string s)
static assert(__traits(getOverloads, B.init, "foo", true)[1](7) == 1); //
Error: need this for foo of type pure nothrow  nogc  safe int(int i)

struct C {
    static int foo()(int i) { return 1; }
    int foo(string s) { return 0; }
}

static assert(__traits(getOverloads, C.init, "foo")[0]("hi") == 0); // Error:
need this for foo of type int(string s)
static assert(__traits(getOverloads, C.init, "foo", true)[0]("hi") == 0); //
Error: need this for foo of type int(string s)
static assert(__traits(getOverloads, C, "foo", true)[1](7) == 1); // works

--
Jul 19 2020