__clear_and_shrink() was added in D41976, and a test was added alongside
it to make sure that the string invariants were maintained. However, it
appears that the test never ran under UBSan before, which would have
highlighted the fact that it doesn't actually maintain the string
invariants.
Differential Revision: https://reviews.llvm.org/D88849
return false;
if (data() == 0)
return false;
- if (data()[size()] != value_type(0))
+ if (data()[size()] != value_type())
return false;
return true;
}
__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());
}
}