January 20, 2023
https://issues.dlang.org/show_bug.cgi?id=23645

          Issue ID: 23645
           Summary: IFTI for templated overload set depends on order of
                    overloads
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: snarwin+bugzilla@gmail.com

As of DMD 2.101.2, the following program fails to compile:

---
template f()
{
    void f(T)(T t) {}
    void f(string s) {}
}

template g()
{
    void g(string s) {}
    void g(T)(T t) {}
}

void main()
{
    f(123); // ok
    g(123); // error
}
---

The error message is:

---
bug.d(16): Error: none of the overloads of template `bug.g` are callable using
argument types `!()(int)`
bug.d(7):        Candidate is: `g()(string s)`
---

Note that the only difference between `f` and `g` is the order of the overloads inside the template.

--