[Issue 4789] std.algorithm.sort bug
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 11 05:46:33 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4789
dawg at dawgfoto.de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
CC| |dawg at dawgfoto.de
Resolution|FIXED |
--- Comment #2 from dawg at 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: -------
More information about the Digitalmars-d-bugs
mailing list