[libcxx] r248304 - Change pair::swap(pair&) to call ADL swap instead of iter_swap; this fixes an obscure bug having to do with overloaded operator&. Fixes PR#24890

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 22 10:50:11 PDT 2015


Author: marshall
Date: Tue Sep 22 12:50:11 2015
New Revision: 248304

URL: http://llvm.org/viewvc/llvm-project?rev=248304&view=rev
Log:
Change pair::swap(pair&) to call ADL swap instead of iter_swap; this fixes an obscure bug having to do with overloaded operator&. Fixes PR#24890

Modified:
    libcxx/trunk/include/utility

Modified: libcxx/trunk/include/utility
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=248304&r1=248303&r2=248304&view=diff
==============================================================================
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Tue Sep 22 12:50:11 2015
@@ -388,8 +388,9 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
     swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value &&
                                __is_nothrow_swappable<second_type>::value)
     {
-        _VSTD::iter_swap(&first, &__p.first);
-        _VSTD::iter_swap(&second, &__p.second);
+        using _VSTD::swap;
+        swap(first,  __p.first);
+        swap(second, __p.second);
     }
 private:
 




More information about the cfe-commits mailing list