summaryrefslogtreecommitdiffstats
path: root/xpcom/string/nsTLiteralString.h
diff options
context:
space:
mode:
Diffstat (limited to 'xpcom/string/nsTLiteralString.h')
-rw-r--r--xpcom/string/nsTLiteralString.h12
1 files changed, 10 insertions, 2 deletions
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<T> {
* 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<T, int>::type get() const&& = delete;
- const typename raw_type<T, int>::type get() const& { return this->mData; }
+ constexpr const typename raw_type<T, int>::type get() const&& = delete;
+ constexpr const typename raw_type<T, int>::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<T> {
extern template class nsTLiteralString<char>;
extern template class nsTLiteralString<char16_t>;
+namespace mozilla {
+constexpr MOZ_IMPLICIT StaticString::StaticString(nsLiteralCString const& str)
+ : mStr(str.get()) {}
+} // namespace mozilla
+
#endif