[libcxx] r248305 - Check in the test for PR#24890 that I forgot in previous commit

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


Author: marshall
Date: Tue Sep 22 12:57:41 2015
New Revision: 248305

URL: http://llvm.org/viewvc/llvm-project?rev=248305&view=rev
Log:
Check in the test for PR#24890 that I forgot in previous commit

Modified:
    libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp

Modified: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp?rev=248305&r1=248304&r2=248305&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp Tue Sep 22 12:57:41 2015
@@ -16,6 +16,14 @@
 #include <utility>
 #include <cassert>
 
+struct S {
+    int i; 
+    S() : i(0) {}
+    S(int j) : i(j) {}
+    S const * operator& () const { assert(false); return this; }
+    bool operator==(int x) const { return i == x; }
+    };
+
 int main()
 {
     {
@@ -25,6 +33,16 @@ int main()
         p1.swap(p2);
         assert(p1.first == 5);
         assert(p1.second == 6);
+        assert(p2.first == 3);
+        assert(p2.second == 4);
+    }
+    {
+        typedef std::pair<int, S> P1;
+        P1 p1(3, S(4));
+        P1 p2(5, S(6));
+        p1.swap(p2);
+        assert(p1.first == 5);
+        assert(p1.second == 6);
         assert(p2.first == 3);
         assert(p2.second == 4);
     }




More information about the cfe-commits mailing list