On Monday, 6 July 2020 at 20:06:51 UTC, Kayomn wrote:
Something discovered in the D Language Code Club Discord server with the help of Wild is that the following code:

struct Test { ~this() {} }
void tester(Test test, Test[] tests...) { }

extern(C) void main() {
    tester(Test(), Test());
}

Raises the "TypeInfo cannot be used with ~betterC" error. It seems to be due to an inclusion of both the destructor and the non-vararg and vararg argument matching from testing.

Anyone know a way around this without resulting to the rather hacky solution of just having 1 argument and always assuming that at least 1 argument is present?

Here is a code demo setup for demonstrating the potential problem:
https://run.dlang.io/is/A6oIpl

This seems to compile:

struct Test { ~this() {} }
void tester(size_t n)(Test[n] tests...)
if (n > 0)
{}

extern(C) void main() {
    tester(Test(), Test());
}

No assumptions, though `tester` does become a template.

I'd say the original error should be reported on bugzilla, if it isn't already; if only for the error message which is ridiculously obscure.

Reply via email to