diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -3941,7 +3941,7 @@ return false; if (data() == 0) return false; - if (data()[size()] != value_type(0)) + if (data()[size()] != value_type()) return false; return true; } @@ -3959,6 +3959,7 @@ __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()); } }