What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
                 CC|                            |
         Resolution|FIXED                       |

--- Comment #2 from 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:
------- You are receiving this mail because: -------

Reply via email to