[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
================
@@ -150,11 +148,41 @@ TEST_CONSTEXPR_CXX20 bool test() {
return true;
}
+template <class SV>
+void test_default_alloc_arg(SV sv, std::size_t pos, std::size_t n) {
+ using A = ControlledDefaultConstructorAllocator<char>;
+ using S = std::basic_string<char, std::char_traits<char>, A>;
+
+ typedef typename S::size_type Size;
+ if (pos <= sv.size()) {
+ A::reset_to_base();
+ S s2(sv, static_cast<Size>(pos), static_cast<Size>(n));
+ assert(s2.get_allocator().is_base());
+ }
+}
+
+void test_default_alloc_arg() {
+ using SV = std::basic_string_view<char, std::char_traits<char> >;
----------------
ldionne wrote:
I think this belongs in `TEST_CONSTEXPR_CXX20 bool test()` (new line 110) instead, with `if (!TEST_IS_CONSTANT_EVALUATED)` since this uses a static. I'd like to avoid adding new layers of complexity to these already complicated tests (which jump through various test functions).
This comment also applies to other test files.
https://github.com/llvm/llvm-project/pull/195839
More information about the libcxx-commits
mailing list