From 6ddbb700511eb51139ebb11786fd0148432df0fe Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 22 Jul 2025 12:58:01 -0400 Subject: [PATCH] AK: Remove constexpr specifier from Utf16View::bytes() The Span constructor used here uses reinterpret_cast under the hood, so it and Utf16View::bytes() cannot be constexpr. --- AK/Utf16View.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AK/Utf16View.h b/AK/Utf16View.h index aa5606b91ee..60d45cdf9be 100644 --- a/AK/Utf16View.h +++ b/AK/Utf16View.h @@ -169,7 +169,7 @@ public: [[nodiscard]] constexpr bool has_ascii_storage() const { return m_length_in_code_units >> Detail::UTF16_FLAG == 0; } - [[nodiscard]] constexpr ReadonlyBytes bytes() const + [[nodiscard]] ALWAYS_INLINE ReadonlyBytes bytes() const { VERIFY(has_ascii_storage()); return { m_string.ascii, length_in_code_units() }; @@ -216,7 +216,7 @@ public: [[nodiscard]] constexpr bool operator==(StringView other) const { if (has_ascii_storage()) - return bytes() == other.bytes(); + return StringView { m_string.ascii, length_in_code_units() } == other; return *this == Utf16View { other.characters_without_null_termination(), other.length() }; }