http://d.puremagic.com/issues/show_bug.cgi?id=9985


monarchdo...@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdo...@gmail.com


--- Comment #1 from monarchdo...@gmail.com 2013-04-24 13:13:57 PDT ---
This is not a bug, but a feature.

D has very efficient move semantics, in particular [N]RVO, because D stipulates
that stack objects may be *moved* without calling postblits.

One of the corollaries to this is that internal pointers are pointers to self
are not accepted as legal code in D, and (as you have noticed) breaks the
program.

Note that your second program exhibits the same behavior: you merely added an
extra copy wich triggers the postblit. You have an intermediary temporary.

Rule of thumb is that you usually don't need internal pointers anyways. If you
absolutely can't do without it, construct your object into a specific place,
and *then* connect the pointers.

I'll close this if the explanation is okay with you.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to