[libc++] Enable libc++-specific tests for constexpr string
Reviewed By: ldionne, Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D128578
NOKEYCHECK=True
GitOrigin-RevId: 7e6a193f13ebd2c352b0bb3cc9279c63988a7c4b
diff --git a/include/string b/include/string
index 4e9bf64..0d42c34 100644
--- a/include/string
+++ b/include/string
@@ -1786,7 +1786,7 @@
allocator_type __a = __str.__alloc();
auto __allocation = std::__allocate_at_least(__a, __str.__get_long_cap());
__begin_lifetime(__allocation.ptr, __allocation.count);
- __clear_and_shrink();
+ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
__alloc() = std::move(__a);
__set_long_pointer(__allocation.ptr);
__set_long_cap(__allocation.count);
@@ -4050,9 +4050,7 @@
if(__is_long())
{
__alloc_traits::deallocate(__alloc(), __get_long_pointer(), capacity() + 1);
- __set_long_cap(0);
- __set_short_size(0);
- traits_type::assign(*__get_short_pointer(), value_type());
+ __default_init();
}
}