Am Fri, 17 Oct 2014 17:25:46 +0000 schrieb "monarch_dodra" <monarchdo...@gmail.com>:
> But maybe this answers your question? > > import std.stdio; > > struct S > { > int* p; > this(this) > { > ++*p; > } > } > > void main() > { > immutable i = 0; > auto s1 = immutable(S)(&i); > auto s2 = s1; > assert(*&i == 0); > } Consider that when passing a variable you can always remove top level const-ness because a copy is made. This holds for returns, parameters, assignments, ... Post-blit is no different. The issue as I see it, is that D doesn't have strong support for this notion of head-mutable or else it would work with this type during post-blit: struct S { immutable(int)* p; this(this) { ++*p; } } -- Marco