Update a couple of vector<bool> tests that were testing libc++-specific bahavior. Thanks to Andrey Maksimov for the catch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348660 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2018-12-07 22:16:26 +00:00
parent f01e82fd42
commit 49ad9aa8cb
3 changed files with 17 additions and 10 deletions

View File

@@ -7,10 +7,15 @@
//
//===----------------------------------------------------------------------===//
// <vector>
// vector<bool>
// vector(const Alloc& = Alloc());
// vector();
// vector(const Alloc&);
// This tests a conforming extension
// For vector<>, this was added to the standard by N4258,
// but vector<bool> was not changed.
#include <vector>
#include <cassert>
@@ -24,9 +29,9 @@ void
test0()
{
#if TEST_STD_VER > 14
static_assert((noexcept(C{})), "" );
LIBCPP_STATIC_ASSERT((noexcept(C{})), "" );
#elif TEST_STD_VER >= 11
static_assert((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
LIBCPP_STATIC_ASSERT((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
#endif
C c;
LIBCPP_ASSERT(c.__invariants());
@@ -45,9 +50,9 @@ void
test1(const typename C::allocator_type& a)
{
#if TEST_STD_VER > 14
static_assert((noexcept(C{typename C::allocator_type{}})), "" );
LIBCPP_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), "" );
LIBCPP_STATIC_ASSERT((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
#endif
C c(a);
LIBCPP_ASSERT(c.__invariants());

View File

@@ -6,6 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <vector>
@@ -13,8 +14,9 @@
// noexcept(is_nothrow_default_constructible<allocator_type>::value);
// This tests a conforming extension
// For vector<>, this was added to the standard by N4258,
// but vector<bool> was not changed.
// UNSUPPORTED: c++98, c++03
#include <vector>
#include <cassert>
@@ -40,7 +42,6 @@ int main()
typedef std::vector<bool, test_allocator<bool>> C;
static_assert(std::is_nothrow_default_constructible<C>::value, "");
}
#endif // _LIBCPP_VERSION
{
typedef std::vector<bool, other_allocator<bool>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
@@ -49,4 +50,5 @@ int main()
typedef std::vector<bool, some_alloc<bool>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
#endif // _LIBCPP_VERSION
}

View File

@@ -6,15 +6,15 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <vector>
// vector()
// noexcept(is_nothrow_default_constructible<allocator_type>::value);
// This tests a conforming extension
// This *was* a conforming extension, but it was adopted in N4258.
// UNSUPPORTED: c++98, c++03
#include <vector>
#include <cassert>