diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2014-02-08 04:03:14 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2014-02-08 04:03:14 +0000 |
| commit | 74cf6ff5e523fa972af797a7a05f9d9b3dddfb5a (patch) | |
| tree | 0257a93fc4a9ee7911e7fa76aa482475b5a887ae /libcxx/include/unordered_map | |
| parent | 57420b320cd989b49e6a458b129b3262834ad589 (diff) | |
| download | bcm5719-llvm-74cf6ff5e523fa972af797a7a05f9d9b3dddfb5a.tar.gz bcm5719-llvm-74cf6ff5e523fa972af797a7a05f9d9b3dddfb5a.zip | |
Fix for PR18735 - self-assignment for map/multimap gives incorrect results in C++03
llvm-svn: 201021
Diffstat (limited to 'libcxx/include/unordered_map')
| -rw-r--r-- | libcxx/include/unordered_map | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map index 78fee4811fa..4e2298bf9b2 100644 --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -831,12 +831,14 @@ public: #if __cplusplus >= 201103L __table_ = __u.__table_; #else - __table_.clear(); - __table_.hash_function() = __u.__table_.hash_function(); - __table_.key_eq() = __u.__table_.key_eq(); - __table_.max_load_factor() = __u.__table_.max_load_factor(); - __table_.__copy_assign_alloc(__u.__table_); - insert(__u.begin(), __u.end()); + if (this != &__u) { + __table_.clear(); + __table_.hash_function() = __u.__table_.hash_function(); + __table_.key_eq() = __u.__table_.key_eq(); + __table_.max_load_factor() = __u.__table_.max_load_factor(); + __table_.__copy_assign_alloc(__u.__table_); + insert(__u.begin(), __u.end()); + } #endif return *this; } @@ -1567,12 +1569,14 @@ public: #if __cplusplus >= 201103L __table_ = __u.__table_; #else - __table_.clear(); - __table_.hash_function() = __u.__table_.hash_function(); - __table_.key_eq() = __u.__table_.key_eq(); - __table_.max_load_factor() = __u.__table_.max_load_factor(); - __table_.__copy_assign_alloc(__u.__table_); - insert(__u.begin(), __u.end()); + if (this != &__u) { + __table_.clear(); + __table_.hash_function() = __u.__table_.hash_function(); + __table_.key_eq() = __u.__table_.key_eq(); + __table_.max_load_factor() = __u.__table_.max_load_factor(); + __table_.__copy_assign_alloc(__u.__table_); + insert(__u.begin(), __u.end()); + } #endif return *this; } |

