diff options
author | George Burgess IV <george.burgess.iv@gmail.com> | 2017-12-11 19:22:59 +0000 |
---|---|---|
committer | George Burgess IV <george.burgess.iv@gmail.com> | 2017-12-11 19:22:59 +0000 |
commit | 1559083a44c32e2d1a70ef9bc5a4942414b4469a (patch) | |
tree | e55381c3e259443ab90c8c15ff82dd0cf1897397 /unittests | |
parent | 1bc958a4c171fa30abf017afe532dc93e21feb97 (diff) |
Ensure moved-from container is cleared on move
In all cases except for this optimistic attempt to reuse memory, the
moved-from TinyPtrVector was left `empty()` at the end of this
assignment. Though using a container after it's been moved from can be a
bit sketchy, it's probably best to just be consistent here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320408 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/ADT/TinyPtrVectorTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/ADT/TinyPtrVectorTest.cpp b/unittests/ADT/TinyPtrVectorTest.cpp index 8d5fa406091..cc14ccc1e54 100644 --- a/unittests/ADT/TinyPtrVectorTest.cpp +++ b/unittests/ADT/TinyPtrVectorTest.cpp @@ -152,6 +152,12 @@ TYPED_TEST(TinyPtrVectorTest, CopyAndMoveCtorTest) { TypeParam Move(std::move(Copy2)); this->expectValues(Move, this->testArray(42)); this->expectValues(Copy2, this->testArray(0)); + + TypeParam MultipleElements(this->testArray(2)); + TypeParam SingleElement(this->testArray(1)); + MultipleElements = std::move(SingleElement); + this->expectValues(MultipleElements, this->testArray(1)); + this->expectValues(SingleElement, this->testArray(0)); } TYPED_TEST(TinyPtrVectorTest, CopyAndMoveTest) { |