--- Comment #3 from Kenji Hara <> 2011-09-20 07:07:18 PDT ---
(In reply to comment #2)
> It might be more complicated then I thought, postblits of members do work.
> I'd better leave the cause of problem to thouse in the know. Another variation
> of test:

I think this is right behavior, and no problem.

Please note this line:
>         a = A(dummy); // a(dummy) was a typo, thought it changes nothing

This is "assignment", not initializing.
The assignment of an object that has postblit (like A) is implemented *swap and
destroy*. For this purpose, D compiler implements opAssign implicitly, like

struct A {
  ref A opAssign(A rhs) {  // rhs is copyed from original value
    std.algorithm.swap(this, rhs);  // bitwise swapping
    return rhs;
    // rhs is equals to original 'this', and it is destroyed here.

Therefore, the assignment of an object of A always increment A.dtor.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to