From dca3bcdd97740b86e248d7778daf270d0ea8335a Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 13 Apr 2017 01:02:41 +0000 Subject: [PATCH] Fix more bad member swap definitions in unordered_map. The __unordered_map_equal and __unordered_map_hash wrappers attempt to swap const qualified predicates whenever the predicate is empty, and is subject to the EBO. Swapping const values seems blatently incorrect. This patch removes the const qualifier so the values are swapped as non-const. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300154 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/unordered_map | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/unordered_map b/include/unordered_map index 3f3808c1e..4fdac160f 100644 --- a/include/unordered_map +++ b/include/unordered_map @@ -404,7 +404,7 @@ public: _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) { using _VSTD::swap; - swap(static_cast(*this), static_cast(__y)); + swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y)); } }; @@ -475,7 +475,7 @@ public: _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) { using _VSTD::swap; - swap(static_cast(*this), static_cast(__y)); + swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y)); } };