www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24135] New: Eponymous template member overloads not shown as

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

          Issue ID: 24135
           Summary: Eponymous template member overloads not shown as call
                    candidates
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: nick geany.org

The following code tries to call 2 eponymous templates with incorrect
arguments:

template skipOver(alias pred = (a, b) => a == b)
{
    bool skipOver(Haystack, Needles...)(ref Haystack haystack, Needles needles)
=> true;
    bool skipOver(R)(ref R r1) => true;
    bool skipOver(R, Es...)(ref R r, Es es) => true;
}

void main()
{
    skipOver();
    t2();
}

template t2(T)
{
    bool t2(string);
    bool t2(int[]);
    bool t2(R)(R);
}

dmd gives:
onemember_overloads.d(29): Error: none of the overloads of template
`onemember_overloads.skipOver` are callable using argument types `!()()`
onemember_overloads.d(18):        Candidate is: `skipOver(alias pred = (a, b)
=> a == b)`
onemember_overloads.d(30): Error: none of the overloads of template
`onemember_overloads.t2` are callable using argument types `!()()`
onemember_overloads.d(33):        Candidate is: `t2(T)(string)`

The error messages only show the first internal overload of each template
declaration when they should each list the 3 members.

PR incoming.

--
Sep 04 2023