forked from OSchip/llvm-project
Make swap_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com.
See D21820 for more information (https://reviews.llvm.org/D21820). llvm-svn: 276590
This commit is contained in:
parent
b8937d6454
commit
2cd516e049
|
@ -22,6 +22,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -96,51 +97,42 @@ int main()
|
||||||
typedef std::pair<const MoveOnly, MoveOnly> V;
|
typedef std::pair<const MoveOnly, MoveOnly> V;
|
||||||
{
|
{
|
||||||
typedef std::map<MoveOnly, MoveOnly> C;
|
typedef std::map<MoveOnly, MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
|
typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
|
typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
|
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{ // POCS allocator, throwable swap for comp
|
{ // POCS allocator, throwable swap for comp
|
||||||
typedef std::map<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc <V>> C;
|
typedef std::map<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc <V>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, throwable swap for comp
|
{ // always equal allocator, throwable swap for comp
|
||||||
typedef std::map<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc2<V>> C;
|
typedef std::map<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc2<V>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, nothrow swap for comp
|
{ // POCS allocator, nothrow swap for comp
|
||||||
typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc <V>> C;
|
typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc <V>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, nothrow swap for comp
|
{ // always equal allocator, nothrow swap for comp
|
||||||
typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc2<V>> C;
|
typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc2<V>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // NOT always equal allocator, nothrow swap for comp
|
{ // NOT always equal allocator, nothrow swap for comp
|
||||||
typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc3<V>> C;
|
typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc3<V>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -96,51 +97,42 @@ int main()
|
||||||
typedef std::pair<const MoveOnly, MoveOnly> V;
|
typedef std::pair<const MoveOnly, MoveOnly> V;
|
||||||
{
|
{
|
||||||
typedef std::multimap<MoveOnly, MoveOnly> C;
|
typedef std::multimap<MoveOnly, MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
|
typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
|
typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
|
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{ // POCS allocator, throwable swap for comp
|
{ // POCS allocator, throwable swap for comp
|
||||||
typedef std::multimap<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc <V>> C;
|
typedef std::multimap<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc <V>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, throwable swap for comp
|
{ // always equal allocator, throwable swap for comp
|
||||||
typedef std::multimap<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc2<V>> C;
|
typedef std::multimap<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc2<V>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, nothrow swap for comp
|
{ // POCS allocator, nothrow swap for comp
|
||||||
typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc <V>> C;
|
typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc <V>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, nothrow swap for comp
|
{ // always equal allocator, nothrow swap for comp
|
||||||
typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc2<V>> C;
|
typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc2<V>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // NOT always equal allocator, nothrow swap for comp
|
{ // NOT always equal allocator, nothrow swap for comp
|
||||||
typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc3<V>> C;
|
typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc3<V>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -95,51 +96,42 @@ int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::multiset<MoveOnly> C;
|
typedef std::multiset<MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
|
typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
|
typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
|
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{ // POCS allocator, throwable swap for comp
|
{ // POCS allocator, throwable swap for comp
|
||||||
typedef std::multiset<MoveOnly, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
|
typedef std::multiset<MoveOnly, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, throwable swap for comp
|
{ // always equal allocator, throwable swap for comp
|
||||||
typedef std::multiset<MoveOnly, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
|
typedef std::multiset<MoveOnly, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, nothrow swap for comp
|
{ // POCS allocator, nothrow swap for comp
|
||||||
typedef std::multiset<MoveOnly, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
|
typedef std::multiset<MoveOnly, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, nothrow swap for comp
|
{ // always equal allocator, nothrow swap for comp
|
||||||
typedef std::multiset<MoveOnly, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
|
typedef std::multiset<MoveOnly, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // NOT always equal allocator, nothrow swap for comp
|
{ // NOT always equal allocator, nothrow swap for comp
|
||||||
typedef std::multiset<MoveOnly, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
|
typedef std::multiset<MoveOnly, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -95,51 +96,42 @@ int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::set<MoveOnly> C;
|
typedef std::set<MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
|
typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
|
typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
|
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{ // POCS allocator, throwable swap for comp
|
{ // POCS allocator, throwable swap for comp
|
||||||
typedef std::set<MoveOnly, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
|
typedef std::set<MoveOnly, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, throwable swap for comp
|
{ // always equal allocator, throwable swap for comp
|
||||||
typedef std::set<MoveOnly, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
|
typedef std::set<MoveOnly, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, nothrow swap for comp
|
{ // POCS allocator, nothrow swap for comp
|
||||||
typedef std::set<MoveOnly, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
|
typedef std::set<MoveOnly, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, nothrow swap for comp
|
{ // always equal allocator, nothrow swap for comp
|
||||||
typedef std::set<MoveOnly, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
|
typedef std::set<MoveOnly, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // NOT always equal allocator, nothrow swap for comp
|
{ // NOT always equal allocator, nothrow swap for comp
|
||||||
typedef std::set<MoveOnly, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
|
typedef std::set<MoveOnly, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
// UNSUPPORTED: c++98, c++03
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "MoveOnly.h"
|
#include "MoveOnly.h"
|
||||||
|
@ -26,7 +27,6 @@ int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::priority_queue<MoveOnly> C;
|
typedef std::priority_queue<MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
// UNSUPPORTED: c++98, c++03
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "MoveOnly.h"
|
#include "MoveOnly.h"
|
||||||
|
@ -25,7 +26,6 @@ int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::queue<MoveOnly> C;
|
typedef std::queue<MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
// UNSUPPORTED: c++98, c++03
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "MoveOnly.h"
|
#include "MoveOnly.h"
|
||||||
|
@ -25,7 +26,6 @@ int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::stack<MoveOnly> C;
|
typedef std::stack<MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -56,35 +57,30 @@ int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::deque<MoveOnly> C;
|
typedef std::deque<MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
|
typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
|
typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
|
typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
|
||||||
C c1, c2;
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
// In c++14, if POCS is set, swapping the allocator is required not to throw
|
// 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<C&>(), std::declval<C&>())), "");
|
||||||
#else
|
#else
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{
|
{
|
||||||
typedef std::deque<MoveOnly, some_alloc2<MoveOnly>> C;
|
typedef std::deque<MoveOnly, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
|
||||||
// if the allocators are always equal, then the swap can be noexcept
|
// if the allocators are always equal, then the swap can be noexcept
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <forward_list>
|
#include <forward_list>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -56,35 +57,30 @@ int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::forward_list<MoveOnly> C;
|
typedef std::forward_list<MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
|
typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
|
typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
|
typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
|
||||||
C c1, c2;
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
// In c++14, if POCS is set, swapping the allocator is required not to throw
|
// 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<C&>(), std::declval<C&>())), "");
|
||||||
#else
|
#else
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{
|
{
|
||||||
typedef std::forward_list<MoveOnly, some_alloc2<MoveOnly>> C;
|
typedef std::forward_list<MoveOnly, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
|
||||||
// if the allocators are always equal, then the swap can be noexcept
|
// if the allocators are always equal, then the swap can be noexcept
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -56,35 +57,30 @@ int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::list<MoveOnly> C;
|
typedef std::list<MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
|
typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
|
typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
|
typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
|
||||||
C c1, c2;
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
// In c++14, if POCS is set, swapping the allocator is required not to throw
|
// 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<C&>(), std::declval<C&>())), "");
|
||||||
#else
|
#else
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{
|
{
|
||||||
typedef std::list<MoveOnly, some_alloc2<MoveOnly>> C;
|
typedef std::list<MoveOnly, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
|
||||||
// if the allocators are always equal, then the swap can be noexcept
|
// if the allocators are always equal, then the swap can be noexcept
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -56,35 +57,30 @@ int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::vector<bool> C;
|
typedef std::vector<bool> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::vector<bool, test_allocator<bool>> C;
|
typedef std::vector<bool, test_allocator<bool>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::vector<bool, other_allocator<bool>> C;
|
typedef std::vector<bool, other_allocator<bool>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::vector<bool, some_alloc<bool>> C;
|
typedef std::vector<bool, some_alloc<bool>> C;
|
||||||
C c1, c2;
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
// In c++14, if POCS is set, swapping the allocator is required not to throw
|
// 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<C&>(), std::declval<C&>())), "");
|
||||||
#else
|
#else
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{
|
{
|
||||||
typedef std::vector<bool, some_alloc2<bool>> C;
|
typedef std::vector<bool, some_alloc2<bool>> C;
|
||||||
C c1, c2;
|
|
||||||
// if the allocators are always equal, then the swap can be noexcept
|
// 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<C&>(), std::declval<C&>())), "");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -57,35 +58,30 @@ int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::vector<MoveOnly> C;
|
typedef std::vector<MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
|
typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
|
typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
|
typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
|
||||||
C c1, c2;
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
// In c++14, if POCS is set, swapping the allocator is required not to throw
|
// 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<C&>(), std::declval<C&>())), "");
|
||||||
#else
|
#else
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{
|
{
|
||||||
typedef std::vector<MoveOnly, some_alloc2<MoveOnly>> C;
|
typedef std::vector<MoveOnly, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
|
||||||
// if the allocators are always equal, then the swap can be noexcept
|
// if the allocators are always equal, then the swap can be noexcept
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -122,79 +123,65 @@ int main()
|
||||||
typedef std::pair<const MoveOnly, MoveOnly> MapType;
|
typedef std::pair<const MoveOnly, MoveOnly> MapType;
|
||||||
{
|
{
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly> C;
|
typedef std::unordered_map<MoveOnly, MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
|
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
|
||||||
std::equal_to<MoveOnly>, test_allocator<MapType>> C;
|
std::equal_to<MoveOnly>, test_allocator<MapType>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
|
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
|
||||||
std::equal_to<MoveOnly>, other_allocator<MapType>> C;
|
std::equal_to<MoveOnly>, other_allocator<MapType>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
|
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
|
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
|
||||||
some_comp<MoveOnly>> C;
|
some_comp<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{ // POCS allocator, throwable swap for hash, throwable swap for comp
|
{ // POCS allocator, throwable swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <MapType>> C;
|
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <MapType>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, throwable swap for hash, throwable swap for comp
|
{ // always equal allocator, throwable swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MapType>> C;
|
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MapType>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, throwable swap for hash, nothrow swap for comp
|
{ // POCS allocator, throwable swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MapType>> C;
|
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MapType>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, throwable swap for hash, nothrow swap for comp
|
{ // always equal allocator, throwable swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MapType>> C;
|
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MapType>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, nothrow swap for hash, throwable swap for comp
|
{ // POCS allocator, nothrow swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <MapType>> C;
|
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <MapType>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, nothrow swap for hash, throwable swap for comp
|
{ // always equal allocator, nothrow swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MapType>> C;
|
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MapType>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, nothrow swap for hash, nothrow swap for comp
|
{ // POCS allocator, nothrow swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MapType>> C;
|
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MapType>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, nothrow swap for hash, nothrow swap for comp
|
{ // always equal allocator, nothrow swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MapType>> C;
|
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MapType>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
|
{ // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<MapType>> C;
|
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<MapType>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -121,78 +122,64 @@ int main()
|
||||||
typedef std::pair<const MoveOnly, MoveOnly> V;
|
typedef std::pair<const MoveOnly, MoveOnly> V;
|
||||||
{
|
{
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
|
typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
|
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
|
||||||
std::equal_to<MoveOnly>, test_allocator<V>> C;
|
std::equal_to<MoveOnly>, test_allocator<V>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
|
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
|
||||||
std::equal_to<MoveOnly>, other_allocator<V>> C;
|
std::equal_to<MoveOnly>, other_allocator<V>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
|
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
|
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
|
||||||
some_comp<MoveOnly>> C;
|
some_comp<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{ // POCS allocator, throwable swap for hash, throwable swap for comp
|
{ // POCS allocator, throwable swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <V>> C;
|
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <V>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, throwable swap for hash, throwable swap for comp
|
{ // always equal allocator, throwable swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<V>> C;
|
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<V>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, throwable swap for hash, nothrow swap for comp
|
{ // POCS allocator, throwable swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <V>> C;
|
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <V>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, throwable swap for hash, nothrow swap for comp
|
{ // always equal allocator, throwable swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<V>> C;
|
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<V>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, nothrow swap for hash, throwable swap for comp
|
{ // POCS allocator, nothrow swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <V>> C;
|
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <V>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, nothrow swap for hash, throwable swap for comp
|
{ // always equal allocator, nothrow swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<V>> C;
|
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<V>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, nothrow swap for hash, nothrow swap for comp
|
{ // POCS allocator, nothrow swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <V>> C;
|
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <V>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, nothrow swap for hash, nothrow swap for comp
|
{ // always equal allocator, nothrow swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<V>> C;
|
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<V>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
|
{ // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<V>> C;
|
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<V>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -122,79 +123,65 @@ int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::unordered_multiset<MoveOnly> C;
|
typedef std::unordered_multiset<MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
|
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
|
||||||
std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
|
std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
|
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
|
||||||
std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
|
std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
|
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
|
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
|
||||||
some_comp<MoveOnly>> C;
|
some_comp<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{ // POCS allocator, throwable swap for hash, throwable swap for comp
|
{ // POCS allocator, throwable swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
|
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, throwable swap for hash, throwable swap for comp
|
{ // always equal allocator, throwable swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
|
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, throwable swap for hash, nothrow swap for comp
|
{ // POCS allocator, throwable swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
|
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, throwable swap for hash, nothrow swap for comp
|
{ // always equal allocator, throwable swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
|
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, nothrow swap for hash, throwable swap for comp
|
{ // POCS allocator, nothrow swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
|
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, nothrow swap for hash, throwable swap for comp
|
{ // always equal allocator, nothrow swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
|
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, nothrow swap for hash, nothrow swap for comp
|
{ // POCS allocator, nothrow swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
|
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, nothrow swap for hash, nothrow swap for comp
|
{ // always equal allocator, nothrow swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
|
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
|
{ // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
|
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -122,79 +123,65 @@ int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::unordered_set<MoveOnly> C;
|
typedef std::unordered_set<MoveOnly> C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
|
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
|
||||||
std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
|
std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
|
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
|
||||||
std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
|
std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
|
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
|
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
|
||||||
some_comp<MoveOnly>> C;
|
some_comp<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{ // POCS allocator, throwable swap for hash, throwable swap for comp
|
{ // POCS allocator, throwable swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
|
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, throwable swap for hash, throwable swap for comp
|
{ // always equal allocator, throwable swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
|
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, throwable swap for hash, nothrow swap for comp
|
{ // POCS allocator, throwable swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
|
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, throwable swap for hash, nothrow swap for comp
|
{ // always equal allocator, throwable swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
|
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, nothrow swap for hash, throwable swap for comp
|
{ // POCS allocator, nothrow swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
|
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, nothrow swap for hash, throwable swap for comp
|
{ // always equal allocator, nothrow swap for hash, throwable swap for comp
|
||||||
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
|
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // POCS allocator, nothrow swap for hash, nothrow swap for comp
|
{ // POCS allocator, nothrow swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
|
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{ // always equal allocator, nothrow swap for hash, nothrow swap for comp
|
{ // always equal allocator, nothrow swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
|
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
|
||||||
C c1, c2;
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
|
{ // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
|
||||||
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
|
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
// This tests a conforming extension
|
// This tests a conforming extension
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
@ -56,30 +57,26 @@ int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef std::string C;
|
typedef std::string C;
|
||||||
C c1, c2;
|
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::basic_string<char, std::char_traits<char>, test_allocator<char>> C;
|
typedef std::basic_string<char, std::char_traits<char>, test_allocator<char>> C;
|
||||||
C c1, c2;
|
LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
static_assert(noexcept(swap(c1, c2)), "");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
|
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
|
||||||
C c1, c2;
|
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
// In c++14, if POCS is set, swapping the allocator is required not to throw
|
// 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<C&>(), std::declval<C&>())), "");
|
||||||
#else
|
#else
|
||||||
static_assert(!noexcept(swap(c1, c2)), "");
|
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if TEST_STD_VER >= 14
|
#if TEST_STD_VER >= 14
|
||||||
{
|
{
|
||||||
typedef std::basic_string<char, std::char_traits<char>, some_alloc2<char>> C;
|
typedef std::basic_string<char, std::char_traits<char>, some_alloc2<char>> C;
|
||||||
C c1, c2;
|
|
||||||
// if the allocators are always equal, then the swap can be noexcept
|
// if the allocators are always equal, then the swap can be noexcept
|
||||||
static_assert( noexcept(swap(c1, c2)), "");
|
static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue