summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std')
-rw-r--r--libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp15
-rw-r--r--libcxx/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp10
-rw-r--r--libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp17
-rw-r--r--libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp11
4 files changed, 48 insertions, 5 deletions
diff --git a/libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
index d3d6670bbf2..07824098fc6 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
@@ -15,6 +15,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -22,11 +23,16 @@ template <class C>
void
test0()
{
+#if TEST_STD_VER > 14
+ static_assert((noexcept(C{})), "" );
+#elif TEST_STD_VER >= 11
+ static_assert((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
+#endif
C c;
assert(c.__invariants());
assert(c.empty());
assert(c.get_allocator() == typename C::allocator_type());
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
C c1 = {};
assert(c1.__invariants());
assert(c1.empty());
@@ -38,6 +44,11 @@ template <class C>
void
test1(const typename C::allocator_type& a)
{
+#if TEST_STD_VER > 14
+ static_assert((noexcept(C{typename C::allocator_type{}})), "" );
+#elif TEST_STD_VER >= 11
+ static_assert((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
+#endif
C c(a);
assert(c.__invariants());
assert(c.empty());
@@ -50,7 +61,7 @@ int main()
test0<std::vector<bool> >();
test1<std::vector<bool, test_allocator<bool> > >(test_allocator<bool>(3));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
test0<std::vector<bool, min_allocator<bool>> >();
test1<std::vector<bool, min_allocator<bool> > >(min_allocator<bool>());
diff --git a/libcxx/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp
index b94588ead93..d0a96480834 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp
@@ -39,11 +39,21 @@ int main()
}
{
typedef std::vector<bool, other_allocator<bool>> C;
+// See N4258 - vector<T, Allocator>::basic_string() noexcept;
+#if TEST_STD_VER <= 14
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+#else
+ static_assert( std::is_nothrow_default_constructible<C>::value, "");
+#endif
}
{
typedef std::vector<bool, some_alloc<bool>> C;
+// See N4258 - vector<T, Allocator>::basic_string() noexcept;
+#if TEST_STD_VER <= 14
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+#else
+ static_assert( std::is_nothrow_default_constructible<C>::value, "");
+#endif
}
#endif
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
index 75772bef78a..9d757bf576a 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
@@ -9,7 +9,8 @@
// <vector>
-// vector(const Alloc& = Alloc());
+// vector();
+// vector(const Alloc&);
#include <vector>
#include <cassert>
@@ -24,12 +25,17 @@ template <class C>
void
test0()
{
+#if TEST_STD_VER > 14
+ static_assert((noexcept(C{})), "" );
+#elif TEST_STD_VER >= 11
+ static_assert((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
+#endif
C c;
assert(c.__invariants());
assert(c.empty());
assert(c.get_allocator() == typename C::allocator_type());
assert(is_contiguous_container_asan_correct(c));
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
C c1 = {};
assert(c1.__invariants());
assert(c1.empty());
@@ -42,6 +48,11 @@ template <class C>
void
test1(const typename C::allocator_type& a)
{
+#if TEST_STD_VER > 14
+ static_assert((noexcept(C{typename C::allocator_type{}})), "" );
+#elif TEST_STD_VER >= 11
+ static_assert((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
+#endif
C c(a);
assert(c.__invariants());
assert(c.empty());
@@ -62,7 +73,7 @@ int main()
std::vector<int, stack_allocator<int, 10> > v;
assert(v.empty());
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
test0<std::vector<int, min_allocator<int>> >();
test0<std::vector<NotConstructible, min_allocator<NotConstructible>> >();
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
index 471c1d407ec..e13a5fc0d35 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
@@ -17,6 +17,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -40,11 +41,21 @@ int main()
}
{
typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
+// See N4258 - vector<T, Allocator>::basic_string() noexcept;
+#if TEST_STD_VER <= 14
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+#else
+ static_assert( std::is_nothrow_default_constructible<C>::value, "");
+#endif
}
{
typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
+// See N4258 - vector<T, Allocator>::basic_string() noexcept;
+#if TEST_STD_VER <= 14
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+#else
+ static_assert( std::is_nothrow_default_constructible<C>::value, "");
+#endif
}
#endif
}
OpenPOWER on IntegriCloud