-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[libc++] Don't instantiate allocators in __tree on an incomplete type #140225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-libcxx Author: Nikolas Klauser (philnik777) ChangesThis causes a mismatch between Full diff: https://github.com/llvm/llvm-project/pull/140225.diff 2 Files Affected:
diff --git a/libcxx/include/map b/libcxx/include/map
index 039ed86dc756f..24eadbd154220 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -911,8 +911,7 @@ public:
private:
typedef std::__value_type<key_type, mapped_type> __value_type;
typedef __map_value_compare<key_type, value_type, key_compare> __vc;
- typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
- typedef __tree<__value_type, __vc, __allocator_type> __base;
+ typedef __tree<__value_type, __vc, allocator_type> __base;
typedef typename __base::__node_traits __node_traits;
typedef allocator_traits<allocator_type> __alloc_traits;
@@ -1596,8 +1595,7 @@ public:
private:
typedef std::__value_type<key_type, mapped_type> __value_type;
typedef __map_value_compare<key_type, value_type, key_compare> __vc;
- typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type;
- typedef __tree<__value_type, __vc, __allocator_type> __base;
+ typedef __tree<__value_type, __vc, allocator_type> __base;
typedef typename __base::__node_traits __node_traits;
typedef allocator_traits<allocator_type> __alloc_traits;
diff --git a/libcxx/test/support/min_allocator.h b/libcxx/test/support/min_allocator.h
index 24505bbb508d6..4072f9776ccd6 100644
--- a/libcxx/test/support/min_allocator.h
+++ b/libcxx/test/support/min_allocator.h
@@ -390,6 +390,9 @@ class min_allocator
typedef T value_type;
typedef min_pointer<T> pointer;
+ // Make sure that value_type is a complete when min_allocator is instantiated
+ static_assert(alignof(value_type) != 0);
+
min_allocator() = default;
template <class U>
TEST_CONSTEXPR_CXX20 min_allocator(min_allocator<U>) {}
|
b60a8be
to
7070a04
Compare
7070a04
to
c8edd06
Compare
The CI failure is unrelated. Landing now, since this fixes a recent regression. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/169/builds/11526 Here is the relevant piece of the build log for the reference
|
This causes a mismatch between
value_type
andallocator_type::value_type
in__tree
, but I think that's acceptable.__tree
primarily gets a__value_type
wrapper due to potential ABI breaks and unwraps it to the same asallocator_type::value_type
in the end. A cleanup patch will also change__tree::value_type
to be the same asallocator_type::value_type
, making the type mismatch only visible where__tree
is instantiated inmap
.