On Saturday, 13 September 2014 at 01:37:59 UTC, Jakob Ovrum wrote:
Now try calling it: http://dpaste.dzfl.pl/bbd02a4d61df

That way it shouldn't work as it would break the type system, that code is equivalent to:

struct S
{
    int* p;

    inout(int)* foo() inout { return p; } // OK

    void bar(void delegate(const int*) dg) const {
        dg(p);
    }
}

void main()
{
        import std.stdio;
        S s;
        writeln(s.foo());
        
        immutable(S) s2;
        s2.bar((const int* p) => writeln(p));
        s.bar((const int* p) => writeln(p));
}

Is there a reason, why you would need inout there?

Reply via email to