AK: Fix usage of constexpr within Utf16View and related utilities

* Error and ErrorOr are not themelves constexpr, so a function returning
  these types cannot be constexpr.

* The UDL was trying to call Utf16View::validate, which is not constexpr
  itself. The compiler will actually already raise an error if a UTF-16
  literal is invalid, so let's just avoid the call altogether.
This commit is contained in:
Timothy Flynn 2025-07-04 08:39:08 -04:00 committed by Shannon Booth
commit 418409aa6f
Notes: github-actions[bot] 2025-07-04 13:26:29 +00:00
2 changed files with 3 additions and 5 deletions

View file

@ -137,7 +137,7 @@ template<typename Callback>
}
template<FallibleFunction<char16_t> Callback>
constexpr ErrorOr<size_t> try_code_point_to_utf16(u32 code_point, Callback callback)
ALWAYS_INLINE ErrorOr<size_t> try_code_point_to_utf16(u32 code_point, Callback callback)
{
if (code_point < FIRST_SUPPLEMENTARY_PLANE_CODE_POINT) {
TRY(callback(static_cast<char16_t>(code_point)));