summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/ADT/TinyPtrVector.h1
-rw-r--r--llvm/unittests/ADT/TinyPtrVectorTest.cpp6
2 files changed, 7 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/TinyPtrVector.h b/llvm/include/llvm/ADT/TinyPtrVector.h
index 79740713f75..73573d65e2b 100644
--- a/llvm/include/llvm/ADT/TinyPtrVector.h
+++ b/llvm/include/llvm/ADT/TinyPtrVector.h
@@ -97,6 +97,7 @@ public:
if (RHS.Val.template is<EltTy>()) {
V->clear();
V->push_back(RHS.front());
+ RHS.Val = (EltTy)nullptr;
return *this;
}
delete V;
diff --git a/llvm/unittests/ADT/TinyPtrVectorTest.cpp b/llvm/unittests/ADT/TinyPtrVectorTest.cpp
index 8d5fa406091..cc14ccc1e54 100644
--- a/llvm/unittests/ADT/TinyPtrVectorTest.cpp
+++ b/llvm/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) {
OpenPOWER on IntegriCloud