Bug 1849070 - Avoid using char_traits. r=spidermonkey-reviewers,anba It is not guaranteed to exist by the standard, and is actively being removed from libc++ in LLVM 18. Differential Revision: https://phabricator.services.mozilla.com/D186421 Upstream-Status: Backport [https://hg.mozilla.org/mozilla-central/rev/68ff4d3f7338248b4d67cf03aade5a73f8d396b2] Signed-off-by: Khem Raj --- a/js/src/builtin/intl/Locale.cpp +++ b/js/src/builtin/intl/Locale.cpp @@ -802,8 +802,10 @@ static inline auto FindUnicodeExtensionT UnicodeKey key) { JS::AutoCheckCannotGC nogc; return unicodeExtension->hasLatin1Chars() - ? FindUnicodeExtensionType(unicodeExtension->latin1Chars(nogc), - unicodeExtension->length(), key) + ? FindUnicodeExtensionType( + reinterpret_cast( + unicodeExtension->latin1Chars(nogc)), + unicodeExtension->length(), key) : FindUnicodeExtensionType(unicodeExtension->twoByteChars(nogc), unicodeExtension->length(), key); } @@ -920,7 +922,9 @@ static BaseNamePartsResult BaseNameParts static inline auto BaseNameParts(JSLinearString* baseName) { JS::AutoCheckCannotGC nogc; return baseName->hasLatin1Chars() - ? BaseNameParts(baseName->latin1Chars(nogc), baseName->length()) + ? BaseNameParts( + reinterpret_cast(baseName->latin1Chars(nogc)), + baseName->length()) : BaseNameParts(baseName->twoByteChars(nogc), baseName->length()); }