diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2015-09-22 17:57:41 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2015-09-22 17:57:41 +0000 |
commit | 835e77e29e441a1839b9f1e8162515aa1c6813ca (patch) | |
tree | 32641b9c4b337929a0547d7db987d1b9716ee3ab /libcxx/test/std | |
parent | 0510a5adc8853031be6062bfd8b94000cb97db3c (diff) | |
download | bcm5719-llvm-835e77e29e441a1839b9f1e8162515aa1c6813ca.tar.gz bcm5719-llvm-835e77e29e441a1839b9f1e8162515aa1c6813ca.zip |
Check in the test for PR#24890 that I forgot in previous commit
llvm-svn: 248305
Diffstat (limited to 'libcxx/test/std')
-rw-r--r-- | libcxx/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
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 <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() { { @@ -28,4 +36,14 @@ int main() 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); + } } |