[Issue 23644] New: Reordering template parameters causes IFTI to fail

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 20 21:10:31 UTC 2023


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

          Issue ID: 23644
           Summary: Reordering template parameters causes IFTI to fail
           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:

---
void f(U : T[], T)(U arg) {}
void g(T, U : T[])(U arg) {}

void main()
{
    int[] a;

    f(a); // ok
    g(a); // IFTI fails
}
---

The error messsage is

---
bug.d(9): Error: none of the overloads of template `bug.g` are callable using
argument types `!()(int[])`
bug.d(2):        Candidate is: `g(T, U : T[])(U arg)`
---

The only difference between `f` and `g` is the order in which their template
parameters are listed, yet the call to `f` succeeds, while the call to `g`
fails to compile.

--


More information about the Digitalmars-d-bugs mailing list