summaryrefslogtreecommitdiff
path: root/external/libwps/0001-Make-comparison-operator-member-functions-const.patch
diff options
context:
space:
mode:
Diffstat (limited to 'external/libwps/0001-Make-comparison-operator-member-functions-const.patch')
-rw-r--r--external/libwps/0001-Make-comparison-operator-member-functions-const.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/external/libwps/0001-Make-comparison-operator-member-functions-const.patch b/external/libwps/0001-Make-comparison-operator-member-functions-const.patch
new file mode 100644
index 000000000000..c7bfb1e40aa2
--- /dev/null
+++ b/external/libwps/0001-Make-comparison-operator-member-functions-const.patch
@@ -0,0 +1,49 @@
+From 555b3e0c18ba16843541867d036da782ecdcdeb1 Mon Sep 17 00:00:00 2001
+From: Stephan Bergmann <sbergman@redhat.com>
+Date: Mon, 21 Oct 2019 16:19:13 +0200
+Subject: [PATCH] Make comparison operator member functions const
+
+...which avoids overload resolution ambiguities in C++20, when a synthesized
+candidate of operator == for a reversed-argument rewrite conflicts with the
+actual operator ==, due to the asymmetric const-ness of the implicit object
+parameter and the RHS parameter. (As observed with recent Clang 10 trunk with
+-std=c++2a when building libwps as part of LibreOffice:
+
+> QuattroDosChart.cpp:399:18: error: use of overloaded operator '!=' is ambiguous (with operand types 'WKSChart::Position' and 'WKSChart::Position')
+> if (ranges[0]!=ranges[1])
+> ~~~~~~~~~^ ~~~~~~~~~
+> ./WKSChart.h:78:8: note: candidate function
+> bool operator!=(Position &pos) const
+> ^
+> ./WKSChart.h:73:8: note: candidate function
+> bool operator==(Position &pos) const
+> ^
+> ./WKSChart.h:73:8: note: candidate function (with reversed parameter order)
+
+)
+---
+ src/lib/WKSChart.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/lib/WKSChart.h b/src/lib/WKSChart.h
+index 268fa4a..e490357 100644
+--- a/src/lib/WKSChart.h
++++ b/src/lib/WKSChart.h
+@@ -70,12 +70,12 @@ public:
+ //! operator<<
+ friend std::ostream &operator<<(std::ostream &o, Position const &pos);
+ //! operator==
+- bool operator==(Position &pos) const
++ bool operator==(Position const &pos) const
+ {
+ return m_pos==pos.m_pos && m_sheetName==pos.m_sheetName;
+ }
+ //! operator!=
+- bool operator!=(Position &pos) const
++ bool operator!=(Position const &pos) const
+ {
+ return !(operator==(pos));
+ }
+--
+2.21.0
+