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

--- Comment #9 from [email protected] ---
(In reply to Sobirari Muhomori from comment #7)
> (In reply to timon.gehr from comment #0)
> > Reading a mutable delegate out of a const reference
> 
> For there to be mutable data accessible through a const reference, the const
> qualifier should not be transitive?
 i
What I meant there is that the type of the field is a mutable delegate type
(and hence it could in principle contain a mutable delegate), which is accessed
through a const 'this' reference.

The issue is that transitivity of const is currently broken for delegate types.
The access must be banned in order to ensure mutable data is not accessible
through a const reference. Otherwise delegates provide a backdoor for
converting const data back to mutable. (I don't think this is much of an issue,
but the designed semantics are that const should be transitive.)

--

Reply via email to