From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- xpcom/string/nsTLiteralString.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'xpcom/string/nsTLiteralString.h') diff --git a/xpcom/string/nsTLiteralString.h b/xpcom/string/nsTLiteralString.h index 38ffd32bdb..0d14614583 100644 --- a/xpcom/string/nsTLiteralString.h +++ b/xpcom/string/nsTLiteralString.h @@ -8,6 +8,7 @@ #define nsTLiteralString_h #include "nsTStringRepr.h" +#include "mozilla/StaticString.h" /** * nsTLiteralString_CharT @@ -78,8 +79,10 @@ class nsTLiteralString : public mozilla::detail::nsTStringRepr { * Prohibit get() on temporaries as in "x"_ns.get(). * These should be written as just "x", using a string literal directly. */ - const typename raw_type::type get() const&& = delete; - const typename raw_type::type get() const& { return this->mData; } + constexpr const typename raw_type::type get() const&& = delete; + constexpr const typename raw_type::type get() const& { + return this->mData; + } // At least older gcc versions do not accept these friend declarations, // complaining about an "invalid argument list" here, but not where the actual @@ -110,4 +113,9 @@ class nsTLiteralString : public mozilla::detail::nsTStringRepr { extern template class nsTLiteralString; extern template class nsTLiteralString; +namespace mozilla { +constexpr MOZ_IMPLICIT StaticString::StaticString(nsLiteralCString const& str) + : mStr(str.get()) {} +} // namespace mozilla + #endif -- cgit v1.2.3