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

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 29 04:41:43 PDT 2026


================
@@ -195,8 +195,14 @@ class test_allocator {
       ++stats_->destroy_count;
     p->~T();
   }
-  TEST_CONSTEXPR friend bool operator==(const test_allocator& x, const test_allocator& y) { return x.data_ == y.data_; }
-  TEST_CONSTEXPR friend bool operator!=(const test_allocator& x, const test_allocator& y) { return !(x == y); }
+  template <class U>
+  TEST_CONSTEXPR friend bool operator==(const test_allocator& x, const test_allocator<U>& y) {
+    return x.data_ == static_cast<const test_allocator&>(y).data_;
----------------
Zingam wrote:

I suppose we won't be supporting GCC15 for much longer. Maybe add a TODO to remove the workaround?

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


More information about the libcxx-commits mailing list