[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:09 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> {
+public:
+ template <class U>
+ struct rebind {
+ typedef ControlledDefaultConstructorAllocator<U> other;
+ };
+
+ ControlledDefaultConstructorAllocator() TEST_NOEXCEPT { default_constructed_tag_ = next_default_constructed_tag_++; }
----------------
ldionne wrote:
I'm not certain it's actually useful to increment the value? We're not trying to test that an allocator is default constructed only once, we're trying to ensure that a default-constructed allocator is used, period.
https://github.com/llvm/llvm-project/pull/195839
More information about the libcxx-commits
mailing list