summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/containers
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2016-04-07 14:20:31 +0000
committerMarshall Clow <mclow.lists@gmail.com>2016-04-07 14:20:31 +0000
commit0ab420570500273e2814a21f65075257b319b59b (patch)
tree6c143e588c44d1e9b40f6676393cbb3830dbaf2d /libcxx/test/std/containers
parentf6660dab0251b86bd0c5412bfd6858bfcd908104 (diff)
downloadbcm5719-llvm-0ab420570500273e2814a21f65075257b319b59b.tar.gz
bcm5719-llvm-0ab420570500273e2814a21f65075257b319b59b.zip
Fix bug #27260 - add missing swap(reference, reference) to vector<bool>.
llvm-svn: 265672
Diffstat (limited to 'libcxx/test/std/containers')
-rw-r--r--libcxx/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/libcxx/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp
new file mode 100644
index 00000000000..d76d4ed2c68
--- /dev/null
+++ b/libcxx/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+// vector<bool>
+
+// static void swap(reference x, reference y) noexcept;
+
+#include <vector>
+#include <cassert>
+
+int main()
+{
+ bool a[] = {false, true, false, true};
+ bool* an = a + sizeof(a)/sizeof(a[0]);
+
+ std::vector<bool> v(a, an);
+ std::vector<bool>::reference r1 = v[0];
+ std::vector<bool>::reference r2 = v[3];
+ assert(!r1);
+ assert( r2);
+ v.swap(r1, r2);
+ assert( r1);
+ assert(!r2);
+} \ No newline at end of file
OpenPOWER on IntegriCloud