From c8e25a71e0397fa28734511fc9d53434f1c6c3e2 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Fri, 20 Jan 2023 15:03:04 -0500 Subject: AK: Disable use of consteval in String::from_utf8_short_string for Apple This causes an ICE on older versions of clang, and Apple's clang is currently based on such a version. --- AK/String.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/AK/String.h b/AK/String.h index 72e0d83731..75f643bfd6 100644 --- a/AK/String.h +++ b/AK/String.h @@ -23,6 +23,13 @@ namespace Detail { class StringData; } +// FIXME: Remove this when Apple Clang fully supports consteval. +#if defined(AK_OS_MACOS) +# define AK_SHORT_STRING_CONSTEVAL constexpr +#else +# define AK_SHORT_STRING_CONSTEVAL consteval +#endif + // String is a strongly owned sequence of Unicode code points encoded as UTF-8. // The data may or may not be heap-allocated, and may or may not be reference counted. // There is no guarantee that the underlying bytes are null-terminated. @@ -51,7 +58,7 @@ public: // Creates a new String from a short sequence of UTF-8 encoded code points. If the provided string // does not fit in the short string storage, a compilation error will be emitted. - static consteval String from_utf8_short_string(StringView string) + static AK_SHORT_STRING_CONSTEVAL String from_utf8_short_string(StringView string) { VERIFY(string.length() <= MAX_SHORT_STRING_BYTE_COUNT); -- cgit v1.2.3