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:
@@ -7,10 +7,15 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// <vector>
|
|
||||||
// vector<bool>
|
// 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 <vector>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@@ -24,9 +29,9 @@ void
|
|||||||
test0()
|
test0()
|
||||||
{
|
{
|
||||||
#if TEST_STD_VER > 14
|
#if TEST_STD_VER > 14
|
||||||
static_assert((noexcept(C{})), "" );
|
LIBCPP_STATIC_ASSERT((noexcept(C{})), "" );
|
||||||
#elif TEST_STD_VER >= 11
|
#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
|
#endif
|
||||||
C c;
|
C c;
|
||||||
LIBCPP_ASSERT(c.__invariants());
|
LIBCPP_ASSERT(c.__invariants());
|
||||||
@@ -45,9 +50,9 @@ void
|
|||||||
test1(const typename C::allocator_type& a)
|
test1(const typename C::allocator_type& a)
|
||||||
{
|
{
|
||||||
#if TEST_STD_VER > 14
|
#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
|
#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
|
#endif
|
||||||
C c(a);
|
C c(a);
|
||||||
LIBCPP_ASSERT(c.__invariants());
|
LIBCPP_ASSERT(c.__invariants());
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
// Source Licenses. See LICENSE.TXT for details.
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
|
||||||
// <vector>
|
// <vector>
|
||||||
|
|
||||||
@@ -13,8 +14,9 @@
|
|||||||
// noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
// noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
||||||
|
|
||||||
// This tests a conforming extension
|
// 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 <vector>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@@ -40,7 +42,6 @@ int main()
|
|||||||
typedef std::vector<bool, test_allocator<bool>> C;
|
typedef std::vector<bool, test_allocator<bool>> C;
|
||||||
static_assert(std::is_nothrow_default_constructible<C>::value, "");
|
static_assert(std::is_nothrow_default_constructible<C>::value, "");
|
||||||
}
|
}
|
||||||
#endif // _LIBCPP_VERSION
|
|
||||||
{
|
{
|
||||||
typedef std::vector<bool, other_allocator<bool>> C;
|
typedef std::vector<bool, other_allocator<bool>> C;
|
||||||
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
|
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
|
||||||
@@ -49,4 +50,5 @@ int main()
|
|||||||
typedef std::vector<bool, some_alloc<bool>> C;
|
typedef std::vector<bool, some_alloc<bool>> C;
|
||||||
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
|
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
|
||||||
}
|
}
|
||||||
|
#endif // _LIBCPP_VERSION
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,15 +6,15 @@
|
|||||||
// Source Licenses. See LICENSE.TXT for details.
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
|
||||||
// <vector>
|
// <vector>
|
||||||
|
|
||||||
// vector()
|
// vector()
|
||||||
// noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
// 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 <vector>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|||||||
Reference in New Issue
Block a user