summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-10-31 13:38:24 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-10-31 15:29:17 +0000
commit40633e32f3925e2041a45b6a574d6b9bd4e844a7 (patch)
treee84d6d84918066eebf758c6fce898f7342873493
parent4f30849f07ea446cc58236e348737897adbbd016 (diff)
Revert "Revert "Prevent nonsensical comparations between OUString and nullptr_t""
This reverts commit e559c0c9cbfd819f22ef695a9823bb71f4385b58; just turn the deleted overloads into non-friend functions (and rely on any other overloads to be still found via ADL). Change-Id: I2af834162cab2e71ed9e32ae6903bc9f86d77ba2 Reviewed-on: https://gerrit.libreoffice.org/30441 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--include/rtl/ustring.hxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 5c097656c917..ff6b834c22d3 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -3226,6 +3226,18 @@ public:
}
};
+#if defined LIBO_INTERNAL_ONLY
+// Prevent the operator ==/!= overloads with 'sal_Unicode const *' paramter from
+// being selected for nonsensical code like
+//
+// if (ouIdAttr == nullptr)
+//
+void operator ==(OUString const &, std::nullptr_t) = delete;
+void operator ==(std::nullptr_t, OUString const &) = delete;
+void operator !=(OUString const &, std::nullptr_t) = delete;
+void operator !=(std::nullptr_t, OUString const &) = delete;
+#endif
+
#if defined LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
/// @cond INTERNAL