summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/rtl/string.hxx15
-rw-r--r--include/rtl/ustring.hxx15
2 files changed, 28 insertions, 2 deletions
diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx
index 0a90fc9f04a3..6af1a1a3b339 100644
--- a/include/rtl/string.hxx
+++ b/include/rtl/string.hxx
@@ -452,9 +452,22 @@ public:
/**
Release the string data.
*/
+#if defined LIBO_INTERNAL_ONLY && __cplusplus >= 202002L
+ constexpr
+#endif
~OString()
{
- rtl_string_release( pData );
+#if defined LIBO_INTERNAL_ONLY && __cplusplus >= 202002L
+ if (std::is_constant_evaluated()) {
+ //TODO: We would want to
+ //
+ // assert(SAL_STRING_IS_STATIC(pData));
+ //
+ // here, but that wouldn't work because read of member `str` of OUStringLiteral's
+ // anonymous union with active member `more` is not allowed in a constant expression.
+ } else
+#endif
+ rtl_string_release( pData );
}
#if defined LIBO_INTERNAL_ONLY
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index f8b5fb461d2f..008f820bb3b1 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -521,9 +521,22 @@ public:
/**
Release the string data.
*/
+#if defined LIBO_INTERNAL_ONLY && __cplusplus >= 202002L
+ constexpr
+#endif
~OUString()
{
- rtl_uString_release( pData );
+#if defined LIBO_INTERNAL_ONLY && __cplusplus >= 202002L
+ if (std::is_constant_evaluated()) {
+ //TODO: We would want to
+ //
+ // assert(SAL_STRING_IS_STATIC(pData));
+ //
+ // here, but that wouldn't work because read of member `str` of OUStringLiteral's
+ // anonymous union with active member `more` is not allowed in a constant expression.
+ } else
+#endif
+ rtl_uString_release( pData );
}
/** Provides an OUString const & passing a storage pointer of an