From 835e77e29e441a1839b9f1e8162515aa1c6813ca Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 22 Sep 2015 17:57:41 +0000 Subject: Check in the test for PR#24890 that I forgot in previous commit llvm-svn: 248305 --- .../utilities/utility/pairs/pairs.pair/swap.pass.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libcxx/test') diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp index a912df00d7b..2e72f3543eb 100644 --- a/libcxx/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp +++ b/libcxx/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); + } } -- cgit v1.2.3