[Issue 24804] New: IFTI fails for variadic static array parameter with narrowing conversion on templated length

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 10 18:04:59 UTC 2024


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

          Issue ID: 24804
           Summary: IFTI fails for variadic static array parameter with
                    narrowing conversion on templated length
           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.109.1, the following program fails to compile:

---
void test(ubyte n)(int[n] a...) {}

void main()
{
    test(1, 2, 3); // error
}
---

The error message is:

---
bug.d(5): Error: template `test` is not callable using argument types `!()(int,
int, int)`
bug.d(1):        Candidate is: `test(ubyte n)(int[n] a...)`
---

Any of the following changes cause the program to compile successfully:

- Changing the call site to `test([1, 2, 3])`
- Changing the call site to `test!3(1, 2, 3)`
- Changing the template parameter of `test` to `size_t n`

--


More information about the Digitalmars-d-bugs mailing list