diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -2260,7 +2260,14 @@ if (this != &__str) { __copy_assign_alloc(__str); - return assign(__str.data(), __str.size()); + if (__str.__is_long()) { + return assign(__str.data(), __str.size()); + } + if (__is_long()) { + __alloc_traits::deallocate(__alloc(), __get_long_pointer(), + __get_long_cap()); + } + __r_.first().__r = __str.__r_.first().__r; } return *this; }