On Wednesday, 29 August 2018 at 18:02:16 UTC, Timon Gehr wrote:
On 29.08.2018 19:15, H. S. Teoh wrote:
On Wed, Aug 29, 2018 at 06:58:16PM +0200, Timon Gehr via Digitalmars-d wrote:
On 28.08.2018 19:02, H. S. Teoh wrote:
On Tue, Aug 28, 2018 at 08:18:57AM +0000, Eugene Wissner via Digitalmars-d wrote:


Currently, immutable implicitly converts to const. If const is allowed to be overridden, then you could violate immutable, which is UB.
...

__mutable fields are __mutable also in the immutable instance. You might get into trouble with shared if you are not careful because of the unfortunate "implicit shared" semantics of immutable, but it is up to the programmer to get this right.

So you cant cast away const but you can specify a field stays mutable even if the aggregate is const or immutable?

Reply via email to