Revert "Update aosp/master libcxx rebase to r263688"

The world is burning.

This reverts commit c004fd909c, reversing
changes made to 1418e4163d.
This commit is contained in:
Dan Albert
2016-05-25 22:36:09 -07:00
parent c004fd909c
commit 1d4a1edbc7
1396 changed files with 11495 additions and 38952 deletions

View File

@@ -29,7 +29,7 @@ test()
static_assert((noexcept(S()) == noexcept(typename S::allocator_type())), "" );
#endif
S s;
LIBCPP_ASSERT(s.__invariants());
assert(s.__invariants());
assert(s.data());
assert(s.size() == 0);
assert(s.capacity() >= s.size());
@@ -42,7 +42,7 @@ test()
static_assert((noexcept(S(typename S::allocator_type())) == std::is_nothrow_copy_constructible<typename S::allocator_type>::value), "" );
#endif
S s(typename S::allocator_type(5));
LIBCPP_ASSERT(s.__invariants());
assert(s.__invariants());
assert(s.data());
assert(s.size() == 0);
assert(s.capacity() >= s.size());
@@ -63,7 +63,7 @@ test2()
static_assert((noexcept(S()) == noexcept(typename S::allocator_type())), "" );
#endif
S s;
LIBCPP_ASSERT(s.__invariants());
assert(s.__invariants());
assert(s.data());
assert(s.size() == 0);
assert(s.capacity() >= s.size());
@@ -76,7 +76,7 @@ test2()
static_assert((noexcept(S(typename S::allocator_type())) == std::is_nothrow_copy_constructible<typename S::allocator_type>::value), "" );
#endif
S s(typename S::allocator_type{});
LIBCPP_ASSERT(s.__invariants());
assert(s.__invariants());
assert(s.data());
assert(s.size() == 0);
assert(s.capacity() >= s.size());

View File

@@ -14,7 +14,6 @@
#include <string>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -23,7 +22,7 @@ test(S s1, typename S::value_type s2)
{
typedef typename S::traits_type T;
s1 = s2;
LIBCPP_ASSERT(s1.__invariants());
assert(s1.__invariants());
assert(s1.size() == 1);
assert(T::eq(s1[0], s2));
assert(s1.capacity() >= s1.size());
@@ -38,7 +37,7 @@ int main()
test(S("123456789"), 'a');
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), 'a');
}
#if TEST_STD_VER >= 11
#if __cplusplus >= 201103L
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), 'a');

View File

@@ -14,7 +14,6 @@
#include <string>
#include <cassert>
#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -23,7 +22,7 @@ void
test(S s1)
{
S s2 = s1;
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(s2 == s1);
assert(s2.capacity() >= s2.size());
assert(s2.get_allocator() == s1.get_allocator());
@@ -38,7 +37,7 @@ int main()
test(S("1", A(5)));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)));
}
#if TEST_STD_VER >= 11
#if __cplusplus >= 201103L
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;

View File

@@ -14,7 +14,6 @@
#include <string>
#include <cassert>
#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -23,7 +22,7 @@ void
test(S s1, const typename S::allocator_type& a)
{
S s2(s1, a);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(s2 == s1);
assert(s2.capacity() >= s2.size());
assert(s2.get_allocator() == a);
@@ -38,7 +37,7 @@ int main()
test(S("1"), A(5));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A(7));
}
#if TEST_STD_VER >= 11
#if __cplusplus >= 201103L
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;

View File

@@ -15,7 +15,6 @@
#include <string>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -23,7 +22,7 @@ void
test(S s1, const S& s2)
{
s1 = s2;
LIBCPP_ASSERT(s1.__invariants());
assert(s1.__invariants());
assert(s1 == s2);
assert(s1.capacity() >= s1.size());
}
@@ -48,7 +47,7 @@ int main()
"1234567890123456789012345678901234567890123456789012345678901234567890"),
S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
}
#if TEST_STD_VER >= 11
#if __cplusplus >= 201103L
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), S());

View File

@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <string>
// basic_string()
@@ -31,6 +29,7 @@ struct some_alloc
int main()
{
#if __has_feature(cxx_noexcept)
{
typedef std::string C;
static_assert(std::is_nothrow_default_constructible<C>::value, "");
@@ -43,4 +42,5 @@ int main()
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
#endif
}

View File

@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <string>
// ~basic_string() // implied noexcept;
@@ -18,6 +16,8 @@
#include "test_allocator.h"
#if __has_feature(cxx_noexcept)
template <class T>
struct some_alloc
{
@@ -26,8 +26,11 @@ struct some_alloc
~some_alloc() noexcept(false);
};
#endif
int main()
{
#if __has_feature(cxx_noexcept)
{
typedef std::string C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -40,4 +43,5 @@ int main()
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
#endif
}

View File

@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <string>
// basic_string(initializer_list<charT> il, const Allocator& a = Allocator());
@@ -21,6 +19,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
{
std::string s = {'a', 'b', 'c'};
assert(s == "abc");
@@ -30,6 +29,7 @@ int main()
s = {L'a', L'b', L'c'};
assert(s == L"abc");
}
#if __cplusplus >= 201103L
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s = {'a', 'b', 'c'};
@@ -41,4 +41,6 @@ int main()
s = {L'a', L'b', L'c'};
assert(s == L"abc");
}
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}

View File

@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <string>
// basic_string& operator=(initializer_list<charT> il);
@@ -20,15 +18,19 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
{
std::string s;
s = {'a', 'b', 'c'};
assert(s == "abc");
}
#if __cplusplus >= 201103L
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s;
s = {'a', 'b', 'c'};
assert(s == "abc");
}
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}

View File

@@ -17,7 +17,6 @@
#include <iterator>
#include <cassert>
#include "test_macros.h"
#include "test_allocator.h"
#include "../input_iterator.h"
#include "min_allocator.h"
@@ -31,7 +30,7 @@ test(It first, It last)
typedef typename S::traits_type T;
typedef typename S::allocator_type A;
S s2(first, last);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(s2.size() == std::distance(first, last));
unsigned i = 0;
for (It it = first; it != last; ++it, ++i)
@@ -48,7 +47,7 @@ test(It first, It last, const A& a)
typedef std::basic_string<charT, std::char_traits<charT>, A> S;
typedef typename S::traits_type T;
S s2(first, last, a);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(s2.size() == std::distance(first, last));
unsigned i = 0;
for (It it = first; it != last; ++it, ++i)
@@ -87,7 +86,7 @@ int main()
test(input_iterator<const char*>(s), input_iterator<const char*>(s+50));
test(input_iterator<const char*>(s), input_iterator<const char*>(s+50), A(2));
}
#if TEST_STD_VER >= 11
#if __cplusplus >= 201103L
{
typedef min_allocator<char> A;
const char* s = "12345678901234567890123456789012345678901234567890";

View File

@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <string>
// basic_string(basic_string<charT,traits,Allocator>&& str);
@@ -16,7 +14,8 @@
#include <string>
#include <cassert>
#include "test_macros.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include "test_allocator.h"
#include "min_allocator.h"
@@ -26,15 +25,18 @@ test(S s0)
{
S s1 = s0;
S s2 = std::move(s0);
LIBCPP_ASSERT(s2.__invariants());
LIBCPP_ASSERT(s0.__invariants());
assert(s2.__invariants());
assert(s0.__invariants());
assert(s2 == s1);
assert(s2.capacity() >= s2.size());
assert(s2.get_allocator() == s1.get_allocator());
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef test_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -42,6 +44,7 @@ int main()
test(S("1", A(5)));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)));
}
#if __cplusplus >= 201103L
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -49,4 +52,6 @@ int main()
test(S("1", A()));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()));
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <string>
// basic_string(basic_string&& str, const Allocator& alloc);
@@ -16,6 +14,8 @@
#include <string>
#include <cassert>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -27,16 +27,23 @@ test(S s0, const typename S::allocator_type& a)
{
S s1 = s0;
S s2(std::move(s0), a);
LIBCPP_ASSERT(s2.__invariants());
LIBCPP_ASSERT(s0.__invariants());
assert(s2.__invariants());
assert(s0.__invariants());
assert(s2 == s1);
assert(s2.capacity() >= s2.size());
assert(s2.get_allocator() == a);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
// #if _LIBCPP_STD_VER <= 14
// _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
// #else
// _NOEXCEPT;
// #endif
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef test_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -63,6 +70,8 @@ int main()
S s2 (std::move(s1), A(1));
}
assert ( test_alloc_base::alloc_count == alloc_count );
#if TEST_STD_VER >= 11
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -75,4 +84,6 @@ int main()
test(S("1"), A());
test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A());
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -7,24 +7,18 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <string>
// basic_string& operator=(basic_string&& c)
// noexcept(
// allocator_traits<allocator_type>::propagate_on_container_move_assignment::value ||
// allocator_traits<allocator_type>::is_always_equal::value); // C++17
//
// before C++17, we use the conforming extension
// noexcept(
// allocator_type::propagate_on_container_move_assignment::value &&
// is_nothrow_move_assignable<allocator_type>::value);
// allocator_type::propagate_on_container_move_assignment::value &&
// is_nothrow_move_assignable<allocator_type>::value);
// This tests a conforming extension
#include <string>
#include <cassert>
#include "test_macros.h"
#include "test_allocator.h"
template <class T>
@@ -34,34 +28,9 @@ struct some_alloc
some_alloc(const some_alloc&);
};
template <class T>
struct some_alloc2
{
typedef T value_type;
some_alloc2() {}
some_alloc2(const some_alloc2&);
void deallocate(void*, unsigned) {}
typedef std::false_type propagate_on_container_move_assignment;
typedef std::true_type is_always_equal;
};
template <class T>
struct some_alloc3
{
typedef T value_type;
some_alloc3() {}
some_alloc3(const some_alloc3&);
void deallocate(void*, unsigned) {}
typedef std::false_type propagate_on_container_move_assignment;
typedef std::false_type is_always_equal;
};
int main()
{
#if __has_feature(cxx_noexcept)
{
typedef std::string C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -72,22 +41,6 @@ int main()
}
{
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
#if TEST_STD_VER > 14
// if the allocators are always equal, then the move assignment can be noexcept
static_assert( std::is_nothrow_move_assignable<C>::value, "");
#else
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
#endif
}
#if TEST_STD_VER > 14
{
// POCMA is false, always equal
typedef std::basic_string<char, std::char_traits<char>, some_alloc2<char>> C;
static_assert( std::is_nothrow_move_assignable<C>::value, "");
}
{
// POCMA is false, not always equal
typedef std::basic_string<char, std::char_traits<char>, some_alloc3<char>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
#endif

View File

@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <string>
// basic_string<charT,traits,Allocator>&
@@ -17,7 +15,8 @@
#include <string>
#include <cassert>
#include "test_macros.h"
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include "test_allocator.h"
#include "min_allocator.h"
@@ -27,14 +26,17 @@ test(S s1, S s2)
{
S s0 = s2;
s1 = std::move(s2);
LIBCPP_ASSERT(s1.__invariants());
LIBCPP_ASSERT(s2.__invariants());
assert(s1.__invariants());
assert(s2.__invariants());
assert(s1 == s0);
assert(s1.capacity() >= s1.size());
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::string S;
test(S(), S());
@@ -53,6 +55,7 @@ int main()
"1234567890123456789012345678901234567890123456789012345678901234567890"),
S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
}
#if __cplusplus >= 201103L
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), S());
@@ -71,4 +74,6 @@ int main()
"1234567890123456789012345678901234567890123456789012345678901234567890"),
S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <string>
// basic_string(basic_string&&)
@@ -31,6 +29,7 @@ struct some_alloc
int main()
{
#if __has_feature(cxx_noexcept)
{
typedef std::string C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
@@ -47,4 +46,5 @@ int main()
static_assert( std::is_nothrow_move_constructible<C>::value, "");
#endif
}
#endif
}

View File

@@ -16,7 +16,6 @@
#include <algorithm>
#include <cassert>
#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -29,7 +28,7 @@ test(const charT* s)
typedef typename S::allocator_type A;
unsigned n = T::length(s);
S s2(s);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(s2.size() == n);
assert(T::compare(s2.data(), s, n) == 0);
assert(s2.get_allocator() == A());
@@ -44,7 +43,7 @@ test(const charT* s, const A& a)
typedef typename S::traits_type T;
unsigned n = T::length(s);
S s2(s, a);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(s2.size() == n);
assert(T::compare(s2.data(), s, n) == 0);
assert(s2.get_allocator() == a);
@@ -69,7 +68,7 @@ int main()
test("123456798012345679801234567980123456798012345679801234567980");
test("123456798012345679801234567980123456798012345679801234567980", A(2));
}
#if TEST_STD_VER >= 11
#if __cplusplus >= 201103L
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;

View File

@@ -15,7 +15,6 @@
#include <string>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -24,7 +23,7 @@ test(S s1, const typename S::value_type* s2)
{
typedef typename S::traits_type T;
s1 = s2;
LIBCPP_ASSERT(s1.__invariants());
assert(s1.__invariants());
assert(s1.size() == T::length(s2));
assert(T::compare(s1.data(), s2, s1.size()) == 0);
assert(s1.capacity() >= s1.size());
@@ -50,7 +49,7 @@ int main()
"1234567890123456789012345678901234567890123456789012345678901234567890"),
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
}
#if TEST_STD_VER >= 11
#if __cplusplus >= 201103L
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(), "");

View File

@@ -16,7 +16,6 @@
#include <algorithm>
#include <cassert>
#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -28,7 +27,7 @@ test(const charT* s, unsigned n)
typedef typename S::traits_type T;
typedef typename S::allocator_type A;
S s2(s, n);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(s2.size() == n);
assert(T::compare(s2.data(), s, n) == 0);
assert(s2.get_allocator() == A());
@@ -42,7 +41,7 @@ test(const charT* s, unsigned n, const A& a)
typedef std::basic_string<charT, std::char_traits<charT>, A> S;
typedef typename S::traits_type T;
S s2(s, n, a);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(s2.size() == n);
assert(T::compare(s2.data(), s, n) == 0);
assert(s2.get_allocator() == a);
@@ -67,7 +66,7 @@ int main()
test("123456798012345679801234567980123456798012345679801234567980", 60);
test("123456798012345679801234567980123456798012345679801234567980", 60, A(2));
}
#if TEST_STD_VER >= 11
#if __cplusplus >= 201103L
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;

View File

@@ -16,7 +16,6 @@
#include <algorithm>
#include <cassert>
#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -28,7 +27,7 @@ test(unsigned n, charT c)
typedef typename S::traits_type T;
typedef typename S::allocator_type A;
S s2(n, c);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(s2.size() == n);
for (unsigned i = 0; i < n; ++i)
assert(s2[i] == c);
@@ -43,7 +42,7 @@ test(unsigned n, charT c, const A& a)
typedef std::basic_string<charT, std::char_traits<charT>, A> S;
typedef typename S::traits_type T;
S s2(n, c, a);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(s2.size() == n);
for (unsigned i = 0; i < n; ++i)
assert(s2[i] == c);
@@ -60,7 +59,7 @@ test(Tp n, Tp c)
typedef typename S::traits_type T;
typedef typename S::allocator_type A;
S s2(n, c);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(s2.size() == n);
for (unsigned i = 0; i < n; ++i)
assert(s2[i] == c);
@@ -76,7 +75,7 @@ test(Tp n, Tp c, const A& a)
typedef std::basic_string<charT, std::char_traits<charT>, A> S;
typedef typename S::traits_type T;
S s2(n, c, a);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(s2.size() == n);
for (unsigned i = 0; i < n; ++i)
assert(s2[i] == c);
@@ -105,7 +104,7 @@ int main()
test(100, 65);
test(100, 65, A(3));
}
#if TEST_STD_VER >= 11
#if __cplusplus >= 201103L
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;

View File

@@ -7,25 +7,17 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-no-exceptions
// <string>
// basic_string(const basic_string<charT,traits,Allocator>& str,
// size_type pos, size_type n,
// const Allocator& a = Allocator());
//
// basic_string(const basic_string<charT,traits,Allocator>& str,
// size_type pos,
// size_type pos, size_type n = npos,
// const Allocator& a = Allocator());
#include <string>
#include <stdexcept>
#include <algorithm>
#include <vector>
#include <scoped_allocator>
#include <cassert>
#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -38,7 +30,7 @@ test(S str, unsigned pos)
try
{
S s2(str, pos);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(pos <= str.size());
unsigned rlen = str.size() - pos;
assert(s2.size() == rlen);
@@ -61,7 +53,7 @@ test(S str, unsigned pos, unsigned n)
try
{
S s2(str, pos, n);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(pos <= str.size());
unsigned rlen = std::min<unsigned>(str.size() - pos, n);
assert(s2.size() == rlen);
@@ -84,7 +76,7 @@ test(S str, unsigned pos, unsigned n, const typename S::allocator_type& a)
try
{
S s2(str, pos, n, a);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.__invariants());
assert(pos <= str.size());
unsigned rlen = std::min<unsigned>(str.size() - pos, n);
assert(s2.size() == rlen);
@@ -98,20 +90,6 @@ test(S str, unsigned pos, unsigned n, const typename S::allocator_type& a)
}
}
#if TEST_STD_VER >= 11
void test2583()
{ // LWG #2583
typedef std::basic_string<char, std::char_traits<char>, test_allocator<char> > StringA;
std::vector<StringA, std::scoped_allocator_adaptor<test_allocator<StringA>>> vs;
StringA s{"1234"};
vs.emplace_back(s, 2);
try { vs.emplace_back(s, 5); }
catch (const std::out_of_range&) { return; }
assert(false);
}
#endif
int main()
{
{
@@ -152,7 +130,7 @@ int main()
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 10, A(8));
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 100, A(8));
}
#if TEST_STD_VER >= 11
#if __cplusplus >= 201103L
{
typedef min_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -191,7 +169,5 @@ int main()
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50, 10, A());
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50, 100, A());
}
test2583();
#endif
}