[libcxx-commits] [libcxx] [libcxx][string] Test: default constructed allocators can be unequal (PR #195839)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 13 11:58:08 PDT 2026


================
@@ -515,4 +515,40 @@ struct SocccAllocator {
   using propagate_on_container_swap            = std::false_type;
 };
 
+// Track how many times the allocator was default-constructed
+//
+
+template <class T>
+class ControlledDefaultConstructorAllocator : public std::allocator<T> {
----------------
ldionne wrote:

I would avoid inheriting from `std::allocator`: let's use the pattern we use above where we do `std::allocator<T>().allocate(n)` instead. This makes this allocator not rely on `std::allocator` properties implicitly.

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


More information about the libcxx-commits mailing list