On Sunday, 2 December 2012 at 13:07:42 UTC, Dan wrote:
Is the default implemented opAssign really pure and therefore
should be considered such.
The code below works. If you turn off the static if, it will
fail with:
Error: pure function 'opAssign.foo' cannot call impure function
'opAssign.S.opAssign'.
Default opAssign function is described here:
http://dlang.org/struct.html. It calls dtor and postblit (if any)
which are impure. Even if you mark them pure, you still
implicitly call opAssign which is not marked as pure. This can be
probably enhanced.
Also, in case the answer is no and default implemented opAssign
must remain impure, is there a standard way, in a member
function to do like:
auto ref opAssign(S other) pure {
blit other into this
call this(this)
}
Thanks
Dan
Are you looking for this http://dpaste.dzfl.pl/7ee27db2 ?