[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
Thu Jun 25 05:01:04 PDT 2026


================
@@ -59,31 +59,33 @@ TEST_CONSTEXPR_CXX20 void test2() {
   {
 #  if TEST_STD_VER > 14
     static_assert((noexcept(S{})), "");
-#  elif TEST_STD_VER >= 11
+#  else
     static_assert((noexcept(S()) == noexcept(typename S::allocator_type())), "");
 #  endif
     S s;
     LIBCPP_ASSERT(s.__invariants());
     assert(s.data());
     assert(s.size() == 0);
     assert(s.capacity() >= s.size());
-    assert(s.get_allocator() == typename S::allocator_type());
+    static_assert(std::is_same<decltype(s.get_allocator()), typename S::allocator_type>::value, "");
+    ASSERT_CONTAINER_ALLOCATOR_EQUALS_DEFAULT(S, s);
     LIBCPP_ASSERT(is_string_asan_correct(s));
   }
   {
 #  if TEST_STD_VER > 14
     static_assert((noexcept(S{typename S::allocator_type{}})), "");
-#  elif TEST_STD_VER >= 11
+#  else
----------------
ldionne wrote:

Same question here for C++03.

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


More information about the libcxx-commits mailing list