[Issue 11772] Can't call function with `inout` `delegate` as argument

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Sep 13 10:03:34 PDT 2014


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

--- Comment #1 from Sobirari Muhomori <dfj1esp02 at 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.

--


More information about the Digitalmars-d-bugs mailing list