[libcxx-commits] [libcxx] [libcxx][test-support] Implement fancy_pointer_allocator (PR #196187)
Nikita Belenkiy via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 25 10:08:08 PDT 2026
================
@@ -393,21 +394,30 @@ namespace detail {
template <class T>
class thread_unsafe_shared_ptr {
public:
- thread_unsafe_shared_ptr() = default;
-
- TEST_CONSTEXPR_CXX14 thread_unsafe_shared_ptr(const thread_unsafe_shared_ptr& other) : block(other.block) {
+ // as it's internal and technically not nullable, we don't care about null pointer state
+ // and don't need destructive move
+ TEST_CONSTEXPR_CXX14 thread_unsafe_shared_ptr(const thread_unsafe_shared_ptr& other) TEST_NOEXCEPT
----------------
kitsnet wrote:
This one is also better to discuss in https://github.com/llvm/llvm-project/pull/195932 .
The goal for fancy_pointer_allocator was to introduce an allocator for a fancy pointer class that:
1. Has all its special methods non-trivial;
2. Is suitable to detecting at least single errors of non-calling nontrivial methods in our handling of the union inside std::basic_string;
3. Is C++20+ consteval friendly - for static_assert tests.
The (3) is a huge limitation in the ways how we can track the calls of our special methods. Fortunately, we already had a class in our testing framework that could be used as a shared state for such tracing (`thread_unsafe_shared_ptr`). Unfortunately, it had some inconsistencies that should have been fixed.
https://github.com/llvm/llvm-project/pull/196187
More information about the libcxx-commits
mailing list