@@ -719,15 +719,18 @@ struct __init_with_sentinel_tag {};
719719template <size_t _PaddingSize>
720720struct __padding {
721721 char __padding_[_PaddingSize];
722- constexpr void clear () {
722+ static constexpr __padding empty () {
723723 __padding __initialized = {0 };
724- * this = __initialized;
724+ return __initialized;
725725 }
726726};
727727
728728template <>
729729struct __padding <0 > {
730- constexpr void clear () {}
730+ static constexpr __padding empty () {
731+ __padding __initialized;
732+ return __initialized;
733+ }
731734};
732735
733736template <class _CharT , class _Traits , class _Allocator >
@@ -928,7 +931,7 @@ private:
928931 // No padding is needed in this version of the structure, but we add a
929932 // zero-sized __padding_ member anyway to match the
930933 // `_LIBCPP_ABI_ALTERNATE_STRING_LAYOUT` version, so that
931- // `__padding_.clear ()` can be performed unconditionally in code common to
934+ // `__padding::empty ()` can be used unconditionally in code common to
932935 // both layouts.
933936 _LIBCPP_NO_UNIQUE_ADDRESS __padding<0 > __padding_;
934937 };
@@ -2817,7 +2820,7 @@ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Trait
28172820 // This is -1 to make sure the caller sets the size properly, since old versions of this function didn't set the size
28182821 // at all.
28192822 __buffer.__size_ = -1 ;
2820- __buffer.__padding_ . clear ();
2823+ __buffer.__padding_ = decltype (__buffer. __padding_ ):: empty ();
28212824 __reset_internal_buffer (__buffer);
28222825}
28232826
0 commit comments