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


d...@dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |d...@dawgfoto.de
         Resolution|FIXED                       |


--- Comment #2 from d...@dawgfoto.de 2011-01-11 05:44:43 PST ---
import std.traits : hasElaborateAssign;
import std.algorithm : swap;

struct Elem {
  ~this() {}
}
static assert(hasElaborateAssign!Elem);

void main() {
  auto elem = Elem();
  swap(elem, elem);
}

----

This bug still exists for structs with elaborate assign.

It throws an "object.Exception: overlapping array copy".

Before changeset 1948 the implementation used memcpy which would have also led
to undefined behavior on some platforms.
Now swap uses _d_arraycopy which throws the overlapping exception.

Proposed fix is to add an "if (lhs !is rhs)" around the struct copy code.

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

Reply via email to