From 81a6812dc9d0c676e189c62d0953b8af6284ae3b Mon Sep 17 00:00:00 2001 From: qicosmos Date: Wed, 17 May 2023 16:34:08 +0800 Subject: [PATCH] fix for clang old version (#288) --- include/struct_pack/struct_pack.hpp | 2 +- include/struct_pack/struct_pack/md5_constexpr.hpp | 6 +++++- include/struct_pack/struct_pack/struct_pack_impl.hpp | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/struct_pack/struct_pack.hpp b/include/struct_pack/struct_pack.hpp index 5affcd7cc..6c5074811 100644 --- a/include/struct_pack/struct_pack.hpp +++ b/include/struct_pack/struct_pack.hpp @@ -154,7 +154,7 @@ STRUCT_PACK_INLINE consteval std::uint32_t get_type_code() { } template -STRUCT_PACK_INLINE consteval decltype(auto) get_type_literal() { +STRUCT_PACK_INLINE constexpr decltype(auto) get_type_literal() { static_assert(sizeof...(Args) > 0); if constexpr (sizeof...(Args) == 1) { using Types = decltype(detail::get_types()); diff --git a/include/struct_pack/struct_pack/md5_constexpr.hpp b/include/struct_pack/struct_pack/md5_constexpr.hpp index 6284a59e3..a649e2d23 100644 --- a/include/struct_pack/struct_pack/md5_constexpr.hpp +++ b/include/struct_pack/struct_pack/md5_constexpr.hpp @@ -71,7 +71,11 @@ template constexpr bool operator!=(const string_literal &s1, const string_literal &s2) { if constexpr (Size1 == Size2) { - return !(s1 == s2); + for (int i = 0; i < Size1; ++i) { + if (s1[i] != s2[i]) + return true; + } + return false; } else { return true; diff --git a/include/struct_pack/struct_pack/struct_pack_impl.hpp b/include/struct_pack/struct_pack/struct_pack_impl.hpp index 52adfd68d..932230d74 100644 --- a/include/struct_pack/struct_pack/struct_pack_impl.hpp +++ b/include/struct_pack/struct_pack/struct_pack_impl.hpp @@ -197,7 +197,7 @@ constexpr inline type_info_config enable_type_info = type_info_config::automatic; template -STRUCT_PACK_INLINE consteval decltype(auto) get_type_literal(); +STRUCT_PACK_INLINE constexpr decltype(auto) get_type_literal(); struct serialize_buffer_size;