[Issue 18094] Crash on variadic arguments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 17 19:07:39 UTC 2017


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

--- Comment #2 from Basile B. <b2.temp at gmx.com> ---
It prefers "in string[]" over "string". Add the "in" parameter storage class to
the overload that takes a string and it works.

---
void Put(in string[] items...)
{
    foreach(item;items) Put(item);
}
void Put(in string item) { }
void test1()
{
    immutable string[] optsldc=["a","a"];
    Put(optsldc);
}
void main()
{
    return test1();
}
---

The problem is, firstly, that the overload rules for this case are not
specified.

https://dlang.org/spec/function.html#overload-sets

--


More information about the Digitalmars-d-bugs mailing list