Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,24 @@ TEST_CONSTEXPR_CXX26 bool test() {
test<std::forward_list<long>>();
test<std::forward_list<double>>();

{ // Ensure that the result of operator== is converted to bool
struct Bool {
Bool() = default;
Bool(const Bool&) = delete;
operator bool() const { return true; }
};

struct Int {
Bool& operator==(Int) const {
static Bool b;
return b;
}
};

std::forward_list<Int> l;
std::erase(l, Int{});
}

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ TEST_CONSTEXPR_CXX20 void emplaceable_concept_tests() {
}

void test_ctor_under_alloc() {
#if TEST_STD_VER >= 11
int arr1[] = {42};
int arr2[] = {1, 101, 42};
#if TEST_STD_VER >= 11
{
using C = TCT::vector<>;
using It = forward_iterator<int*>;
Expand All @@ -155,6 +155,35 @@ void test_ctor_under_alloc() {
}
}
#endif
// FIXME: This is mostly the same test as above, just worse. They should be merged.
{
typedef std::vector<int, cpp03_allocator<int> > C;
typedef C::allocator_type Alloc;
{
Alloc::construct_called = false;
C v(arr1, arr1 + 1);
assert(Alloc::construct_called);
}
{
Alloc::construct_called = false;
C v(arr2, arr2 + 3);
assert(Alloc::construct_called);
}
}
{
typedef std::vector<int, cpp03_overload_allocator<int> > C;
typedef C::allocator_type Alloc;
{
Alloc::construct_called = false;
C v(arr1, arr1 + 1);
assert(Alloc::construct_called);
}
{
Alloc::construct_called = false;
C v(arr2, arr2 + 3);
assert(Alloc::construct_called);
}
}
}

// In C++03, you can't instantiate a template with a local type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ TEST_CONSTEXPR_CXX20 void emplaceable_concept_tests() {
}

void test_ctor_under_alloc() {
#if TEST_STD_VER >= 11
int arr1[] = {42};
int arr2[] = {1, 101, 42};
#if TEST_STD_VER >= 11
{
using C = TCT::vector<>;
using It = forward_iterator<int*>;
Expand Down Expand Up @@ -173,6 +173,37 @@ void test_ctor_under_alloc() {
}
}
#endif
// FIXME: This is mostly the same test as above, just worse. They should be merged.
{
typedef std::vector<int, cpp03_allocator<int> > C;
typedef C::allocator_type Alloc;
Alloc a;
{
Alloc::construct_called = false;
C v(arr1, arr1 + 1, a);
assert(Alloc::construct_called);
}
{
Alloc::construct_called = false;
C v(arr2, arr2 + 3, a);
assert(Alloc::construct_called);
}
}
{
typedef std::vector<int, cpp03_overload_allocator<int> > C;
typedef C::allocator_type Alloc;
Alloc a;
{
Alloc::construct_called = false;
C v(arr1, arr1 + 1, a);
assert(Alloc::construct_called);
}
{
Alloc::construct_called = false;
C v(arr2, arr2 + 3, a);
assert(Alloc::construct_called);
}
}
}

TEST_CONSTEXPR_CXX20 bool test() {
Expand Down
Loading