Fix for PR18735 - self-assignment for map/multimap gives incorrect results in C++03

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201021 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2014-02-08 04:03:14 +00:00
parent cf7278afd7
commit ebfc50ee89
10 changed files with 171 additions and 20 deletions

View File

@@ -884,10 +884,12 @@ public:
#if __cplusplus >= 201103L
__tree_ = __m.__tree_;
#else
__tree_.clear();
__tree_.value_comp() = __m.__tree_.value_comp();
__tree_.__copy_assign_alloc(__m.__tree_);
insert(__m.begin(), __m.end());
if (this != &__m) {
__tree_.clear();
__tree_.value_comp() = __m.__tree_.value_comp();
__tree_.__copy_assign_alloc(__m.__tree_);
insert(__m.begin(), __m.end());
}
#endif
return *this;
}
@@ -1616,10 +1618,12 @@ public:
#if __cplusplus >= 201103L
__tree_ = __m.__tree_;
#else
__tree_.clear();
__tree_.value_comp() = __m.__tree_.value_comp();
__tree_.__copy_assign_alloc(__m.__tree_);
insert(__m.begin(), __m.end());
if (this != &__m) {
__tree_.clear();
__tree_.value_comp() = __m.__tree_.value_comp();
__tree_.__copy_assign_alloc(__m.__tree_);
insert(__m.begin(), __m.end());
}
#endif
return *this;
}