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

Xavier Bonaventura via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 20 01:39:02 PDT 2026


================
@@ -67,7 +67,10 @@ TEST_CONSTEXPR_CXX20 void test2() {
     assert(s.data());
     assert(s.size() == 0);
     assert(s.capacity() >= s.size());
-    assert(s.get_allocator() == typename S::allocator_type());
+#  if TEST_STD_VER >= 11
----------------
limdor wrote:

Why did you added this `#if`? Because of `is_same` being available only with C++11? `allocator_type` was alredy having this issue due to being part of allocators traits being introduced in C++11.
Maybe I'm overseeing something but I do not thing this pragma is needed. This whole code is in an `#if TEST_STD_VER >= 11` that starts in [line 55](https://github.com/llvm/llvm-project/pull/195839/changes#diff-b79f0eb4ae7126c19884f1b493c7790f2d9f5c76a2db611fe0a842c6410e4956R55)
Interesting enough in [line 62](https://github.com/llvm/llvm-project/pull/195839/changes#diff-b79f0eb4ae7126c19884f1b493c7790f2d9f5c76a2db611fe0a842c6410e4956L62) there is also an `#elif TEST_STD_VER` that with the same logic could be replaces with an `#else`. I would propose removing the `#  if TEST_STD_VER >= 11` and agobe in line 62 replace it for an else.
@frederick-vs-ja what do you think?

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


More information about the libcxx-commits mailing list