From 85ad05396a1e3ef8e7468974a6ae653b84711f2a Mon Sep 17 00:00:00 2001 From: MattStephanson <68978048+MattStephanson@users.noreply.github.com> Date: Thu, 14 Jan 2021 18:28:03 -0800 Subject: [PATCH] : fill should accept volatile byte pointers (#1557) Co-authored-by: Stephan T. Lavavej --- stl/inc/xutility | 5 +++-- tests/std/tests/VSO_0180469_fill_family/test.cpp | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/stl/inc/xutility b/stl/inc/xutility index 653646d54..f484b23b1 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -4361,11 +4361,12 @@ 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 +// _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>>>, - 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 c932d75f0..6c3bef212 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); });