[Issue 16572] can't take inout delegate

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Oct 3 06:45:59 PDT 2016


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

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #3 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to anonymous4 from comment #2)
> A small interaction between contravariance and inout here:
> inout(A) f(inout B b) inout;
> If you resolve the type as A delegate(B) you can't pass const(B) as argument.

You wouldn't be able to take a valid delegate of this. Or at least an
operational one.

The delegate type would have to be something like:

inout(A) delegate(inout B) inout=const

We don't have a way to express this.

As it stands, I think the delegate to this would have to be:

const(A) delegate(const(B) b) const

--


More information about the Digitalmars-d-bugs mailing list