From 3bbca0d6b081fd856f34d72aa24cefa1b11755b5 Mon Sep 17 00:00:00 2001 From: Bill Date: Fri, 23 Sep 2022 17:45:37 +0800 Subject: [PATCH] fix g++ constexpr --- server/types.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/server/types.h b/server/types.h index 13d1b72..b41da78 100644 --- a/server/types.h +++ b/server/types.h @@ -196,13 +196,22 @@ namespace types { struct astring_view { const unsigned char* str = 0; - constexpr astring_view(const char* str) : - str((const unsigned char*)(str)) {} - constexpr astring_view(const signed char* str) : + +#if defined(__clang__) or !defined(__GNUC__) + constexpr +#endif + astring_view(const char* str) noexcept : + str((const unsigned char*)(str)) {} +#if defined(__clang__) or !defined(__GNUC__) + constexpr +#endif + astring_view(const signed char* str) noexcept : str((const unsigned char*)(str)) {} - constexpr astring_view(const unsigned char* str) : + + constexpr + astring_view(const unsigned char* str) noexcept : str(str) {} - constexpr astring_view() = default; + constexpr astring_view() noexcept = default; bool operator==(const astring_view& r) const { auto this_str = str;