Fix for PR3946, in which SmallVector could behave strangely in corner cases.

Patch by Peter Johnson.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69785 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2009-04-22 07:16:54 +00:00
parent 41b1a489f5
commit 747972914a

View File

@ -302,7 +302,7 @@ public:
append(End-NumToInsert, End);
// Copy the existing elements that get replaced.
std::copy(I, OldEnd-NumToInsert, I+NumToInsert);
std::copy_backward(I, OldEnd-NumToInsert, OldEnd);
std::fill_n(I, NumToInsert, Elt);
return I;
@ -351,7 +351,7 @@ public:
append(End-NumToInsert, End);
// Copy the existing elements that get replaced.
std::copy(I, OldEnd-NumToInsert, I+NumToInsert);
std::copy_backward(I, OldEnd-NumToInsert, OldEnd);
std::copy(From, To, I);
return I;