[libcxx-commits] [libcxx] [libcxx][test-support] Implement fancy_pointer_allocator (PR #196187)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 25 09:00:43 PDT 2026


================
@@ -424,6 +434,33 @@ class thread_unsafe_shared_ptr {
     T content;
   };
 
+  thread_unsafe_shared_ptr() = default;
+
+  TEST_CONSTEXPR_CXX20 void detach_control_block() {
+    --block->ref_count;
+    if (block->ref_count != 0)
+      return;
+    typedef std::allocator_traits<std::allocator<control_block> > allocator_traits;
+    std::allocator<control_block> alloc;
+    allocator_traits::destroy(alloc, block);
+#ifdef COUNT_NEW_H
----------------
ldionne wrote:

I am very very uncomfortable with this kind of check. Let's first talk about why these changes are needed, but if they are, I'd like us to find a different way to do this (e.g. a template parameter).

https://github.com/llvm/llvm-project/pull/196187


More information about the libcxx-commits mailing list