Thread overview
[Issue 17401] type inference broken when F and Parameters!F are used
May 16, 2017
Tomer Filiba
May 16, 2017
Tomer Filiba
May 16, 2017
Vladimir Panteleev
Mar 27, 2020
Walter Bright
Dec 17, 2022
Iain Buclaw
Jan 02, 2023
Luís Ferreira
May 16, 2017
https://issues.dlang.org/show_bug.cgi?id=17401

Tomer Filiba <tomerfiliba@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry

--
May 16, 2017
https://issues.dlang.org/show_bug.cgi?id=17401

--- Comment #1 from Tomer Filiba <tomerfiliba@gmail.com> ---
the first version (wrap1) would have been OK, but it cannot be used with `ref`/`scope`/`lazy` etc, as these would be lost when using `T...`. so

void f(ref int x) {}
int x;
wrap1(&f, x);   // void function(int) != void function(ref int)

--
May 16, 2017
https://issues.dlang.org/show_bug.cgi?id=17401

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow@gmail.com

--- Comment #2 from Vladimir Panteleev <thecybershadow@gmail.com> ---
Mixing IFTI arguments and arguments derived from IFTI arguments is currently not supported. (It was surely reported before in another issue.)

A workaround is:

    void wrap5(F, Args...)(F fn, Args args) if (is(Args == Parameters!F)) {}
    wrap5(&f, x);

> void f(ref int x) {}
> int x;
> wrap1(&f, x);   // void function(int) != void function(ref int)

Just for ref, "auto ref" usually suffices.

BTW, I noticed you added the industry keyword. If you haven't already, consider adding your company to http://dlang.org/orgs-using-d.html.

--
May 16, 2017
https://issues.dlang.org/show_bug.cgi?id=17401

--- Comment #3 from Tomer Filiba (weka) <tomer@weka.io> ---
I'm from weka (updated my email to the company's email thanks to your advice)

--
March 27, 2020
https://issues.dlang.org/show_bug.cgi?id=17401

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> ---
Minimal test case:

----
  void f(int x) {}

  void wrap(F)(F fn, S!F args) {}

  struct S(F) { }

  void test() {
    wrap(&f, 1);
  }
----

test.d(9): Error: template `test2.wrap` cannot deduce function from argument
 types `!()(void function(int x), int)`, candidates are:
test.d(4):        `test2.wrap(F)(F fn, S!F args)`

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--
January 02, 2023
https://issues.dlang.org/show_bug.cgi?id=17401

Luís Ferreira <contact@lsferreira.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |contact@lsferreira.net

--- Comment #5 from Luís Ferreira <contact@lsferreira.net> ---
This seem to be an issue with delegates too.

--