Thread overview
[Issue 11772] Can't call function with `inout` `delegate` as argument
Sep 13, 2014
Sobirari Muhomori
Sep 13, 2014
Sobirari Muhomori
Dec 17, 2022
Iain Buclaw
September 13, 2014
https://issues.dlang.org/show_bug.cgi?id=11772

--- Comment #1 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
Another test case
---
struct S
{
    void bar(void delegate(inout int*) dg) inout
    {
        dg(null);
    }
}

void main()
{
    import std.stdio;
    S s;
    immutable(S) s2;
    s2.bar((inout int* p) => writeln(p));
    s.bar((inout int* p) => writeln(p));
}
---
Error: inout method S.bar is not callable using a immutable object Error: inout method S.bar is not callable using a mutable object
---

Works for function, but not for delegate.

--
September 13, 2014
https://issues.dlang.org/show_bug.cgi?id=11772

--- Comment #2 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
void f(inout int*, inout(int)* delegate(inout int*)){}

void g()
{
    immutable int a;
    f(&a,x=>x);
}
---
Error: function f (inout(int*) _param_0, inout(int)* delegate(inout(int*))
_param_1) is not callable using argument types (immutable(int)*, void)
---

Again works for function, but not for delegate.

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--