www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21050] New: __traits(getOverloads) for templates returns

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

          Issue ID: 21050
           Summary: __traits(getOverloads) for templates returns incorrect
                    symbol for the first overload
           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 S {
    static void foo(T)(int i) {}
    static void foo(T)(string s) {}
}

alias foo0 = __traits(getOverloads, S, "foo", true)[0];
alias bar0 = foo0!long; // Error: template `S.foo` matches more than one
template declaration

alias foo1 = __traits(getOverloads, S, "foo", true)[1];
alias bar1 = foo1!int; // works fine

Trying to use the first overload is behaving exactly as if I were using S.foo
directly.

--
Jul 17 2020