Thread overview
[Issue 16345] IFTI fails with lazy variadic function in some cases
Aug 01, 2016
ag0aep6g@gmail.com
Dec 17, 2022
Iain Buclaw
August 01, 2016
https://issues.dlang.org/show_bug.cgi?id=16345

ag0aep6g@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |ag0aep6g@gmail.com
            Summary|lazy variadic function in   |IFTI fails with lazy
                   |template with default value |variadic function in some
                   |cannot be deduced           |cases

--- Comment #1 from ag0aep6g@gmail.com ---
For reference, the spec describes lazy variadic functions here: http://dlang.org/spec/function.html#lazy_variadic_functions

The test case doesn't need the template parameters to fail. This fails, too:

----
void all()(void delegate()[] dgs ...) {}
void f() {}
void main() { all(f()); } /* Error: template test.all cannot deduce function
from argument types !()(void) */
----

It works when the return type is int or another primitive type, including pointers and arrays:

----
void all()(int delegate()[] dgs ...) {}
int f() { return 0; }
void main() { all(f()); } /* no error */
----

But it fails with Object and user-defined aggregates. Most peculiarly, it also fails with an alias to a primitive type:

----
alias T = int;
void all()(T delegate()[] dgs ...) {}
T f() { return T.init; }
void main() { all(f()); } /* Error: template test.all cannot deduce function
from argument types !()(int) */
----

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=16345

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 13
https://issues.dlang.org/show_bug.cgi?id=16345

--- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19167

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--