[Issue 23645] New: IFTI for templated overload set depends on order of overloads

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 20 21:40:12 UTC 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 at puremagic.com
          Reporter: snarwin+bugzilla at 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.

--


More information about the Digitalmars-d-bugs mailing list