From 842e3f6f517446e3a565add7b15bcabe07b2c400 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 22 Sep 2015 17:57:41 +0000 Subject: [PATCH] Check in the test for PR#24890 that I forgot in previous commit git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@248305 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../utility/pairs/pairs.pair/swap.pass.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp index a912df00d..2e72f3543 100644 --- a/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp +++ b/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp @@ -16,6 +16,14 @@ #include #include +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() { { @@ -28,4 +36,14 @@ int main() assert(p2.first == 3); assert(p2.second == 4); } + { + typedef std::pair 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); + } }