-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Labels
libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.test-suite
Description
This test_alloc
has a rebind
struct, but not a rebinding constructor:
llvm-project/libcxx/test/std/strings/basic.string/string.capacity/deallocate_size.pass.cpp
Lines 22 to 46 in 564fd62
template <class T, class Sz> | |
struct test_alloc { | |
typedef Sz size_type; | |
typedef typename std::make_signed<Sz>::type difference_type; | |
typedef T value_type; | |
typedef value_type* pointer; | |
typedef const value_type* const_pointer; | |
typedef typename std::add_lvalue_reference<value_type>::type reference; | |
typedef typename std::add_lvalue_reference<const value_type>::type const_reference; | |
template <class U> | |
struct rebind { | |
typedef test_alloc<U, Sz> other; | |
}; | |
TEST_CONSTEXPR_CXX14 pointer allocate(size_type n, const void* = nullptr) { | |
allocated_ += n; | |
return std::allocator<value_type>().allocate(n); | |
} | |
TEST_CONSTEXPR_CXX14 void deallocate(pointer p, size_type s) { | |
allocated_ -= s; | |
std::allocator<value_type>().deallocate(p, s); | |
} | |
}; |
This fails to meet the allocator requirements. MSVC's STL rejects this because we attempt to rebind the allocator (to an internal "container proxy" type).
I observe other requirement deficiencies here (no comparison operators) but the rebinding one is the specific problem for us.
Metadata
Metadata
Assignees
Labels
libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.test-suite