Pull in r201021 from upstream libc++ trunk:

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

(Please note: that is an LLVM PR identifier, not a FreeBSD one.)

Reported by:	rakuco
MFC after:	3 days
This commit is contained in:
Dimitry Andric
2014-03-13 23:09:48 +00:00
parent 68d17718e0
commit a0492a1142
2 changed files with 28 additions and 20 deletions
+4
View File
@@ -884,10 +884,12 @@ public:
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
__tree_ = __m.__tree_; __tree_ = __m.__tree_;
#else #else
if (this != &__m) {
__tree_.clear(); __tree_.clear();
__tree_.value_comp() = __m.__tree_.value_comp(); __tree_.value_comp() = __m.__tree_.value_comp();
__tree_.__copy_assign_alloc(__m.__tree_); __tree_.__copy_assign_alloc(__m.__tree_);
insert(__m.begin(), __m.end()); insert(__m.begin(), __m.end());
}
#endif #endif
return *this; return *this;
} }
@@ -1616,10 +1618,12 @@ public:
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
__tree_ = __m.__tree_; __tree_ = __m.__tree_;
#else #else
if (this != &__m) {
__tree_.clear(); __tree_.clear();
__tree_.value_comp() = __m.__tree_.value_comp(); __tree_.value_comp() = __m.__tree_.value_comp();
__tree_.__copy_assign_alloc(__m.__tree_); __tree_.__copy_assign_alloc(__m.__tree_);
insert(__m.begin(), __m.end()); insert(__m.begin(), __m.end());
}
#endif #endif
return *this; return *this;
} }
+4
View File
@@ -831,12 +831,14 @@ public:
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
__table_ = __u.__table_; __table_ = __u.__table_;
#else #else
if (this != &__u) {
__table_.clear(); __table_.clear();
__table_.hash_function() = __u.__table_.hash_function(); __table_.hash_function() = __u.__table_.hash_function();
__table_.key_eq() = __u.__table_.key_eq(); __table_.key_eq() = __u.__table_.key_eq();
__table_.max_load_factor() = __u.__table_.max_load_factor(); __table_.max_load_factor() = __u.__table_.max_load_factor();
__table_.__copy_assign_alloc(__u.__table_); __table_.__copy_assign_alloc(__u.__table_);
insert(__u.begin(), __u.end()); insert(__u.begin(), __u.end());
}
#endif #endif
return *this; return *this;
} }
@@ -1567,12 +1569,14 @@ public:
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
__table_ = __u.__table_; __table_ = __u.__table_;
#else #else
if (this != &__u) {
__table_.clear(); __table_.clear();
__table_.hash_function() = __u.__table_.hash_function(); __table_.hash_function() = __u.__table_.hash_function();
__table_.key_eq() = __u.__table_.key_eq(); __table_.key_eq() = __u.__table_.key_eq();
__table_.max_load_factor() = __u.__table_.max_load_factor(); __table_.max_load_factor() = __u.__table_.max_load_factor();
__table_.__copy_assign_alloc(__u.__table_); __table_.__copy_assign_alloc(__u.__table_);
insert(__u.begin(), __u.end()); insert(__u.begin(), __u.end());
}
#endif #endif
return *this; return *this;
} }