On Fri, 29 Apr 2011 10:43:56 -0400, Alexander <[email protected]> wrote:

Doing some experiments, and after conversion of struct into a class I've found that opAssign(), contrary to what documentation says, is silently accepted for classes (in D 2.052)

opAssign is only invalid if you are assigning something that implicitly converts to that type.

So this will fail:

typeof(this) opAssign(typeof(this) otherthing) {...}

What is worse, it segfaults when object is not constructed first:

x = y is equivalent to x.opAssign(y). So x is null, you are dereferencing a null pointer.

-Steve

Reply via email to