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


David Simcha <dsim...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dsim...@yahoo.com
         Resolution|                            |FIXED


--- Comment #1 from David Simcha <dsim...@yahoo.com> 2010-09-02 20:52:24 PDT ---
Here's the swap algorithm used in the int[] instantiation in std.algorithm:

auto t = a;
a = b;
b = t;

This function is broken for static arrays if a and b are the same array, and in
your example, swap() gets called with the rhs and lhs being the same array. 
This is probably related to using optimized memcpy() routines under the hood
for copying static arrays.  The language should arguably do the right thing
when a static array is assigned to itself instead of this kind of crazy
behavior. 

In the mean time, I've inserted a trivial check into swap() that only gets
compiled in for static arrays.  It's a kludge, but it's a trivial,
well-encapsulated kludge and can be removed when the deeper issue gets solved.

http://dsource.org/projects/phobos/changeset/1948

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

Reply via email to