Fix SmallDenseMap assignment operator.

Self assignment would lead to buckets of garbage, causing quadratic probing to hang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214790 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Trick
2014-08-04 22:18:25 +00:00
parent 2c68cde701
commit e85047ea0a
2 changed files with 10 additions and 2 deletions

View File

@@ -244,6 +244,11 @@ TYPED_TEST(DenseMapTest, AssignmentTest) {
EXPECT_EQ(1u, copyMap.size());
EXPECT_EQ(this->getValue(), copyMap[this->getKey()]);
// test self-assignment.
copyMap = copyMap;
EXPECT_EQ(1u, copyMap.size());
EXPECT_EQ(this->getValue(), copyMap[this->getKey()]);
}
// Test swap method