summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-04-21 23:38:59 +0000
committerEric Fiselier <eric@efcs.ca>2016-04-21 23:38:59 +0000
commitf07dd8d0a925dd8cbde7bb6198c1ba92446110ea (patch)
tree581032748ea2b3640d2e7f033f2e651eb67416bd /libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp
parentc89755e4cbad7a46d747f3b2d49c50a80855a801 (diff)
downloadbcm5719-llvm-f07dd8d0a925dd8cbde7bb6198c1ba92446110ea.tar.gz
bcm5719-llvm-f07dd8d0a925dd8cbde7bb6198c1ba92446110ea.zip
Add is_swappable/is_nothrow_swappable traits
llvm-svn: 267079
Diffstat (limited to 'libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp')
-rw-r--r--libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp b/libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp
index 91ebe419a0a..8d01dbf959c 100644
--- a/libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp
@@ -15,10 +15,19 @@
#include <cassert>
#include <array>
+#include "test_macros.h"
+
// std::array is explicitly allowed to be initialized with A a = { init-list };.
// Disable the missing braces warning for this reason.
#include "disable_missing_braces_warning.h"
+struct NonSwappable {
+ NonSwappable() {}
+private:
+ NonSwappable(NonSwappable const&);
+ NonSwappable& operator=(NonSwappable const&);
+};
+
int main()
{
{
@@ -70,5 +79,15 @@ int main()
assert(c1.size() == 0);
assert(c2.size() == 0);
}
+ {
+ typedef NonSwappable T;
+ typedef std::array<T, 0> C0;
+ C0 l = {};
+ C0 r = {};
+ l.swap(r);
+#if TEST_STD_VER >= 11
+ static_assert(noexcept(l.swap(r)), "");
+#endif
+ }
}
OpenPOWER on IntegriCloud