Index: test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp +++ test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp @@ -22,6 +22,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -96,51 +97,42 @@ typedef std::pair V; { typedef std::map C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::map, test_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::map, other_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::map> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } #if TEST_STD_VER >= 14 { // POCS allocator, throwable swap for comp typedef std::map, some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, throwable swap for comp typedef std::map, some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, nothrow swap for comp typedef std::map, some_alloc > C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, nothrow swap for comp typedef std::map, some_alloc2> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // NOT always equal allocator, nothrow swap for comp typedef std::map, some_alloc3> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); } #endif Index: test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp +++ test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp @@ -22,6 +22,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -96,51 +97,42 @@ typedef std::pair V; { typedef std::multimap C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::multimap, test_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::multimap, other_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::multimap> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } #if TEST_STD_VER >= 14 { // POCS allocator, throwable swap for comp typedef std::multimap, some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, throwable swap for comp typedef std::multimap, some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, nothrow swap for comp typedef std::multimap, some_alloc > C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, nothrow swap for comp typedef std::multimap, some_alloc2> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // NOT always equal allocator, nothrow swap for comp - typedef std::map, some_alloc3> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + typedef std::multimap, some_alloc3> C; + LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); } #endif } Index: test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp +++ test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp @@ -22,6 +22,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -95,51 +96,42 @@ { { typedef std::multiset C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::multiset, test_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::multiset, other_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::multiset> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } #if TEST_STD_VER >= 14 { // POCS allocator, throwable swap for comp typedef std::multiset, some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, throwable swap for comp typedef std::multiset, some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, nothrow swap for comp typedef std::multiset, some_alloc > C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, nothrow swap for comp typedef std::multiset, some_alloc2> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // NOT always equal allocator, nothrow swap for comp typedef std::multiset, some_alloc3> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); } #endif } Index: test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp +++ test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp @@ -22,6 +22,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -95,51 +96,42 @@ { { typedef std::set C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::set, test_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::set, other_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::set> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } #if TEST_STD_VER >= 14 { // POCS allocator, throwable swap for comp typedef std::set, some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, throwable swap for comp typedef std::set, some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, nothrow swap for comp typedef std::set, some_alloc > C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, nothrow swap for comp typedef std::set, some_alloc2> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // NOT always equal allocator, nothrow swap for comp typedef std::set, some_alloc3> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); } #endif Index: test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp +++ test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp @@ -18,6 +18,7 @@ // UNSUPPORTED: c++98, c++03 #include +#include #include #include "MoveOnly.h" @@ -26,7 +27,6 @@ { { typedef std::priority_queue C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } } Index: test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp +++ test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp @@ -17,6 +17,7 @@ // UNSUPPORTED: c++98, c++03 #include +#include #include #include "MoveOnly.h" @@ -25,7 +26,6 @@ { { typedef std::queue C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } } Index: test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp +++ test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp @@ -17,6 +17,7 @@ // UNSUPPORTED: c++98, c++03 #include +#include #include #include "MoveOnly.h" @@ -25,7 +26,6 @@ { { typedef std::stack C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } } Index: test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp +++ test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp @@ -21,6 +21,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -56,35 +57,30 @@ { { typedef std::deque C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::deque> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::deque> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::deque> C; - C c1, c2; #if TEST_STD_VER >= 14 // In c++14, if POCS is set, swapping the allocator is required not to throw - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); #else - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); #endif } #if TEST_STD_VER >= 14 { typedef std::deque> C; - C c1, c2; // if the allocators are always equal, then the swap can be noexcept - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } #endif Index: test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp +++ test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp @@ -21,6 +21,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -56,35 +57,30 @@ { { typedef std::forward_list C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::forward_list> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::forward_list> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::forward_list> C; - C c1, c2; #if TEST_STD_VER >= 14 // In c++14, if POCS is set, swapping the allocator is required not to throw - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); #else - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); #endif } #if TEST_STD_VER >= 14 { typedef std::forward_list> C; - C c1, c2; // if the allocators are always equal, then the swap can be noexcept - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } #endif } Index: test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp +++ test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp @@ -21,6 +21,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -56,35 +57,30 @@ { { typedef std::list C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::list> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::list> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::list> C; - C c1, c2; #if TEST_STD_VER >= 14 // In c++14, if POCS is set, swapping the allocator is required not to throw - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); #else - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); #endif } #if TEST_STD_VER >= 14 { typedef std::list> C; - C c1, c2; // if the allocators are always equal, then the swap can be noexcept - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } #endif Index: test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp +++ test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp @@ -22,6 +22,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -56,35 +57,30 @@ { { typedef std::vector C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::vector> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::vector> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::vector> C; - C c1, c2; #if TEST_STD_VER >= 14 // In c++14, if POCS is set, swapping the allocator is required not to throw - static_assert( noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); #else - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); #endif } #if TEST_STD_VER >= 14 { typedef std::vector> C; - C c1, c2; // if the allocators are always equal, then the swap can be noexcept - static_assert( noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); } #endif } Index: test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp +++ test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp @@ -22,6 +22,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -57,35 +58,30 @@ { { typedef std::vector C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::vector> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::vector> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::vector> C; - C c1, c2; #if TEST_STD_VER >= 14 // In c++14, if POCS is set, swapping the allocator is required not to throw - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); #else - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); #endif } #if TEST_STD_VER >= 14 { typedef std::vector> C; - C c1, c2; // if the allocators are always equal, then the swap can be noexcept - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } #endif } Index: test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp +++ test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp @@ -26,6 +26,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -122,79 +123,65 @@ typedef std::pair MapType; { typedef std::unordered_map C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_map, std::equal_to, test_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_map, std::equal_to, other_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_map> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_map, some_comp> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } #if TEST_STD_VER >= 14 { // POCS allocator, throwable swap for hash, throwable swap for comp typedef std::unordered_map, some_comp , some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, throwable swap for hash, throwable swap for comp typedef std::unordered_map, some_comp , some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, throwable swap for hash, nothrow swap for comp typedef std::unordered_map, some_comp2, some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, throwable swap for hash, nothrow swap for comp typedef std::unordered_map, some_comp2, some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, nothrow swap for hash, throwable swap for comp typedef std::unordered_map, some_comp , some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, nothrow swap for hash, throwable swap for comp typedef std::unordered_map, some_comp , some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_map, some_comp2, some_alloc > C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_map, some_comp2, some_alloc2> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_map, some_comp2, some_alloc3> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); } #endif } Index: test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp @@ -26,6 +26,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -121,78 +122,64 @@ typedef std::pair V; { typedef std::unordered_multimap C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_multimap, std::equal_to, test_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_multimap, std::equal_to, other_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_multimap> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_multimap, some_comp> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } #if TEST_STD_VER >= 14 { // POCS allocator, throwable swap for hash, throwable swap for comp typedef std::unordered_multimap, some_comp , some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, throwable swap for hash, throwable swap for comp typedef std::unordered_multimap, some_comp , some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, throwable swap for hash, nothrow swap for comp typedef std::unordered_multimap, some_comp2, some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, throwable swap for hash, nothrow swap for comp typedef std::unordered_multimap, some_comp2, some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, nothrow swap for hash, throwable swap for comp typedef std::unordered_multimap, some_comp , some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, nothrow swap for hash, throwable swap for comp typedef std::unordered_multimap, some_comp , some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_multimap, some_comp2, some_alloc > C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_multimap, some_comp2, some_alloc2> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_multimap, some_comp2, some_alloc3> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); } #endif } Index: test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp +++ test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp @@ -26,6 +26,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -122,79 +123,65 @@ { { typedef std::unordered_multiset C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_multiset, std::equal_to, test_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_multiset, std::equal_to, other_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_multiset> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_multiset, some_comp> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } #if TEST_STD_VER >= 14 { // POCS allocator, throwable swap for hash, throwable swap for comp typedef std::unordered_multiset, some_comp , some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, throwable swap for hash, throwable swap for comp typedef std::unordered_multiset, some_comp , some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, throwable swap for hash, nothrow swap for comp typedef std::unordered_multiset, some_comp2, some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, throwable swap for hash, nothrow swap for comp typedef std::unordered_multiset, some_comp2, some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, nothrow swap for hash, throwable swap for comp typedef std::unordered_multiset, some_comp , some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, nothrow swap for hash, throwable swap for comp typedef std::unordered_multiset, some_comp , some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_multiset, some_comp2, some_alloc > C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_multiset, some_comp2, some_alloc2> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_multiset, some_comp2, some_alloc3> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); } #endif } Index: test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp =================================================================== --- test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp +++ test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp @@ -26,6 +26,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -122,79 +123,65 @@ { { typedef std::unordered_set C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_set, std::equal_to, test_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_set, std::equal_to, other_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_set> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_set, some_comp> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } #if TEST_STD_VER >= 14 { // POCS allocator, throwable swap for hash, throwable swap for comp typedef std::unordered_set, some_comp , some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, throwable swap for hash, throwable swap for comp typedef std::unordered_set, some_comp , some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, throwable swap for hash, nothrow swap for comp typedef std::unordered_set, some_comp2, some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, throwable swap for hash, nothrow swap for comp typedef std::unordered_set, some_comp2, some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, nothrow swap for hash, throwable swap for comp typedef std::unordered_set, some_comp , some_alloc > C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, nothrow swap for hash, throwable swap for comp typedef std::unordered_set, some_comp , some_alloc2> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); } { // POCS allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_set, some_comp2, some_alloc > C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // always equal allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_set, some_comp2, some_alloc2> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_set, some_comp2, some_alloc3> C; - C c1, c2; - static_assert( noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); } #endif } Index: test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp =================================================================== --- test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp +++ test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp @@ -22,6 +22,7 @@ // This tests a conforming extension #include +#include #include #include "test_macros.h" @@ -56,30 +57,26 @@ { { typedef std::string C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::basic_string, test_allocator> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); + LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::basic_string, some_alloc> C; - C c1, c2; #if TEST_STD_VER >= 14 // In c++14, if POCS is set, swapping the allocator is required not to throw - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); #else - static_assert(!noexcept(swap(c1, c2)), ""); + static_assert(!noexcept(swap(std::declval(), std::declval())), ""); #endif } #if TEST_STD_VER >= 14 { typedef std::basic_string, some_alloc2> C; - C c1, c2; // if the allocators are always equal, then the swap can be noexcept - static_assert( noexcept(swap(c1, c2)), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } #endif }