diff --git a/include/ylt/struct_pack/util.h b/include/ylt/struct_pack/util.h index 834b97c2a..d2d4d9342 100644 --- a/include/ylt/struct_pack/util.h +++ b/include/ylt/struct_pack/util.h @@ -178,13 +178,16 @@ template class string_thief inline void resize(std::basic_string &raw_str, std::size_t sz) { std::string &str = *reinterpret_cast(&raw_str); -#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) || \ +#if defined(__SANITIZE_ADDRESS__) || \ + struct_pack_has_feature(address_sanitizer) || \ (!defined(NDEBUG) && defined(_MSVC_STL_VERSION)) raw_str.resize(sz); #elif defined(__GLIBCXX__) || defined(_LIBCPP_VERSION) || \ @@ -248,7 +251,7 @@ template class vector_thief::_Mypair), template inline void resize(std::vector &raw_vec, std::size_t sz) { -#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) +#if defined(__SANITIZE_ADDRESS__) || struct_pack_has_feature(address_sanitizer) raw_vec.resize(sz); #elif defined(__GLIBCXX__) || \ (defined(_LIBCPP_VERSION) && defined(_LIBCPP_HAS_NO_ASAN)) || \ @@ -262,9 +265,7 @@ inline void resize(std::vector &raw_vec, std::size_t sz) { } #endif -#ifndef __clang__ -#undef __has_feature -#endif +#undef struct_pack_has_feature template inline void resize(T &str, std::size_t sz) {