summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-20 15:03:04 -0500
committerLinus Groh <mail@linusgroh.de>2023-01-20 20:33:04 +0000
commitc8e25a71e0397fa28734511fc9d53434f1c6c3e2 (patch)
tree237664fe4e4471e4c48a4a45208cc45161b6d761
parent95d1678553b7d3c1c46247b84f84e8bf3bff083f (diff)
downloadserenity-c8e25a71e0397fa28734511fc9d53434f1c6c3e2.zip
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.
-rw-r--r--AK/String.h9
1 files changed, 8 insertions, 1 deletions
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);