https://issues.dlang.org/show_bug.cgi?id=20116
Simen Kjaeraas <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] Summary|Cannot return inout return |Wrong delegate type when |value from delegate |taking address of inout | |member function --- Comment #2 from Simen Kjaeraas <[email protected]> --- I've updated the description to give a better description of what's actually wrong here. The actual issue is what typeof(&c.arr) returns - it needs to reflect the constancy of c - inout makes no sense on the context of a delegate. IOW, this: class C { int[] _arr; auto fun() inout { return _arr; } } static assert(is(typeof(&(new C).fun) == int[] delegate())); static assert(is(typeof(&(new const C).fun) == const (int[]) delegate())); static assert(is(typeof(&(new immutable C).fun) == immutable(int[]) delegate())); should compile. --
