Skip to content

Commit 911d9ad

Browse files
committed
Replace __padding::clear() with __padding::empty()
One of the buildbot failures was objecting to a constexpr function returning void, I guess because that's from a later C++ version.
1 parent 6baee1c commit 911d9ad

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

libcxx/include/string

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -719,15 +719,18 @@ struct __init_with_sentinel_tag {};
719719
template <size_t _PaddingSize>
720720
struct __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

728728
template <>
729729
struct __padding<0> {
730-
constexpr void clear() {}
730+
static constexpr __padding empty() {
731+
__padding __initialized;
732+
return __initialized;
733+
}
731734
};
732735

733736
template <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

Comments
 (0)