[libcxx-commits] [libcxx] [libc++][test] Fix construction and comparison for testing allocators (PR #212702)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 5 19:08:41 PDT 2026


================
@@ -65,8 +71,14 @@ class no_default_allocator {
 
   TEST_CONSTEXPR_CXX20 void deallocate(T* p, std::size_t n) { std::allocator<T>().deallocate(p, n); }
 
-  friend TEST_CONSTEXPR bool operator==(no_default_allocator, no_default_allocator) { return true; }
-  friend TEST_CONSTEXPR bool operator!=(no_default_allocator x, no_default_allocator y) { return !(x == y); }
+  template <class U>
+  friend TEST_CONSTEXPR bool operator==(no_default_allocator, no_default_allocator<U>) {
----------------
frederick-vs-ja wrote:

I think it's preferred to make them hidden friends. Let me try to use `<class T, class U>` in hidden friend functions later.

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


More information about the libcxx-commits mailing list