[libcxx] r300154 - Fix more bad member swap definitions in unordered_map.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 12 18:02:41 PDT 2017


Author: ericwf
Date: Wed Apr 12 20:02:41 2017
New Revision: 300154

URL: http://llvm.org/viewvc/llvm-project?rev=300154&view=rev
Log:
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.

Modified:
    libcxx/trunk/include/unordered_map

Modified: libcxx/trunk/include/unordered_map
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/unordered_map?rev=300154&r1=300153&r2=300154&view=diff
==============================================================================
--- libcxx/trunk/include/unordered_map (original)
+++ libcxx/trunk/include/unordered_map Wed Apr 12 20:02:41 2017
@@ -404,7 +404,7 @@ public:
         _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
     {
         using _VSTD::swap;
-        swap(static_cast<const _Hash&>(*this), static_cast<const _Hash&>(__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<const _Pred&>(*this), static_cast<const _Pred&>(__y));
+        swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y));
     }
 };
 




More information about the cfe-commits mailing list