From fd2db699fdd65a4e791ec7041716cc90c5d98ec7 Mon Sep 17 00:00:00 2001 From: Matt Stephanson Date: Tue, 5 Jan 2021 22:50:00 -0800 Subject: [PATCH 1/2] Don't use _Fill_memset for volatile byte. --- stl/inc/xutility | 3 ++- tests/std/tests/VSO_0180469_fill_family/test.cpp | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/stl/inc/xutility b/stl/inc/xutility index d817785ee82..a88372cdd0f 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -4352,10 +4352,11 @@ template <> struct _Is_character_or_byte_or_bool : true_type {}; // _Fill_memset_is_safe determines if _FwdIt and _Ty are eligible for memset optimization in fill +// Need to explicity test for volatile because _Unwrap_enum_t discards qualifiers. template > _INLINE_VAR constexpr bool _Fill_memset_is_safe = conjunction_v, _Is_character_or_byte_or_bool<_Unwrap_enum_t>>>, - is_assignable<_Iter_ref_t<_FwdIt>, const _Ty&>>; + negation>>>, is_assignable<_Iter_ref_t<_FwdIt>, const _Ty&>>; template _INLINE_VAR constexpr bool _Fill_memset_is_safe<_FwdIt, _Ty, false> = false; diff --git a/tests/std/tests/VSO_0180469_fill_family/test.cpp b/tests/std/tests/VSO_0180469_fill_family/test.cpp index c932d75f092..6c3bef212b9 100644 --- a/tests/std/tests/VSO_0180469_fill_family/test.cpp +++ b/tests/std/tests/VSO_0180469_fill_family/test.cpp @@ -134,6 +134,9 @@ int main() { test_fill(); test_fill(); // Test GH-1183 +#ifdef __cpp_lib_byte + test_fill(); // 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); }); From 0b35409dfa99fe1fcf78d224c0d6f42cd0147db1 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 8 Jan 2021 17:54:52 -0800 Subject: [PATCH 2/2] Fix comment typo --- stl/inc/xutility | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stl/inc/xutility b/stl/inc/xutility index a88372cdd0f..f94be0d282a 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -4351,8 +4351,8 @@ struct _Is_character_or_byte_or_bool : true_type {}; template <> struct _Is_character_or_byte_or_bool : true_type {}; -// _Fill_memset_is_safe determines if _FwdIt and _Ty are eligible for memset optimization in fill -// Need to explicity test for volatile because _Unwrap_enum_t discards qualifiers. +// _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 > _INLINE_VAR constexpr bool _Fill_memset_is_safe = conjunction_v, _Is_character_or_byte_or_bool<_Unwrap_enum_t>>>,