Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions stl/inc/xutility
Original file line number Diff line number Diff line change
Expand Up @@ -4351,11 +4351,12 @@ struct _Is_character_or_byte_or_bool<byte> : true_type {};
template <>
struct _Is_character_or_byte_or_bool<bool> : true_type {};

// _Fill_memset_is_safe determines if _FwdIt and _Ty are eligible for memset optimization in fill
// _Fill_memset_is_safe determines if _FwdIt and _Ty are eligible for memset optimization in fill.
// Need to explicitly test for volatile because _Unwrap_enum_t discards qualifiers.
template <class _FwdIt, class _Ty, bool = is_pointer_v<_FwdIt>>
_INLINE_VAR constexpr bool _Fill_memset_is_safe = conjunction_v<is_scalar<_Ty>,
_Is_character_or_byte_or_bool<_Unwrap_enum_t<remove_reference_t<_Iter_ref_t<_FwdIt>>>>,
is_assignable<_Iter_ref_t<_FwdIt>, const _Ty&>>;
negation<is_volatile<remove_reference_t<_Iter_ref_t<_FwdIt>>>>, is_assignable<_Iter_ref_t<_FwdIt>, const _Ty&>>;

template <class _FwdIt, class _Ty>
_INLINE_VAR constexpr bool _Fill_memset_is_safe<_FwdIt, _Ty, false> = false;
Expand Down
3 changes: 3 additions & 0 deletions tests/std/tests/VSO_0180469_fill_family/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ int main() {
test_fill<char, int>();

test_fill<volatile char, char>(); // Test GH-1183
#ifdef __cpp_lib_byte
test_fill<volatile byte, byte>(); // Test GH-1556
#endif // __cpp_lib_byte

test_uninitialized_fill(
[](count_copies* buff, size_t n, const count_copies& src) { uninitialized_fill(buff, buff + n, src); });
Expand Down