diff --git a/AK/StringView.h b/AK/StringView.h index 783a50ff480ba6a64fed57a2de1a8840afe9a42f..821b706b90250498d91438b6612009a455fd92d5 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -301,7 +301,15 @@ struct CaseInsensitiveStringViewTraits : public Traits { } -[[nodiscard]] ALWAYS_INLINE constexpr AK::StringView operator"" sv(const char* cstring, size_t length) +// FIXME: Remove this when clang fully supports consteval (specifically in the context of default parameter initialization). +// See: https://stackoverflow.com/questions/68789984/immediate-function-as-default-function-argument-initializer-in-clang +#if defined(__clang__) +# define AK_STRING_VIEW_LITERAL_CONSTEVAL constexpr +#else +# define AK_STRING_VIEW_LITERAL_CONSTEVAL consteval +#endif + +[[nodiscard]] ALWAYS_INLINE AK_STRING_VIEW_LITERAL_CONSTEVAL AK::StringView operator"" sv(const char* cstring, size_t length) { return AK::StringView(cstring, length); }