diff options
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.cpp | 19 |
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 + } } |