summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-10-21 16:46:00 +0200
committerTor Lillqvist <tml@collabora.com>2020-04-30 07:38:56 +0200
commita4e427deb2d168bb8e95ba0b12a0d49441854f67 (patch)
tree8bef423dd77deb04408c39e89e0386dc7b99540c
parent5a8a5229a43483d3468b769c3cbff03dbe052ecf (diff)
external/libwps: Make comparison operator member functions const
see commit message of external/libwps/0001-Make-comparison-operator-member-functions-const.patch for details Change-Id: Ib8702f57f47aacc08628ceaccce23b487660b95c Reviewed-on: https://gerrit.libreoffice.org/81249 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93183 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r--external/libwps/0001-Make-comparison-operator-member-functions-const.patch49
-rw-r--r--external/libwps/UnpackedTarball_libwps.mk3
2 files changed, 52 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
+
diff --git a/external/libwps/UnpackedTarball_libwps.mk b/external/libwps/UnpackedTarball_libwps.mk
index f982c778a218..18e01a3cce84 100644
--- a/external/libwps/UnpackedTarball_libwps.mk
+++ b/external/libwps/UnpackedTarball_libwps.mk
@@ -15,8 +15,11 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,libwps,1))
$(eval $(call gb_UnpackedTarball_update_autoconf_configs,libwps))
+# * external/libwps/0001-Make-comparison-operator-member-functions-const.patch is upstream at
+# <https://sourceforge.net/p/libwps/patches/6/> "Make comparison operator member functions const":
$(eval $(call gb_UnpackedTarball_add_patches,libwps,\
$(if $(SYSTEM_REVENGE),,external/libwps/rpath.patch.0) \
+ external/libwps/0001-Make-comparison-operator-member-functions-const.patch \
))
ifneq ($(OS),MACOSX)