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.
This commit is contained in:
Timothy Flynn 2025-07-22 12:58:01 -04:00 committed by Tim Flynn
commit 6ddbb70051
Notes: github-actions[bot] 2025-07-22 17:34:57 +00:00

View file

@ -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() };
}