summaryrefslogtreecommitdiff
path: root/external/libstaroffice/0001-Fix-equality-operator-arguments.patch.1
blob: 27fd97727e25cae3640ddf75dea399d0ee627063 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From 9c0ff663659a28720c4ee3f5752bb8ce8121648f Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Mon, 21 Oct 2019 17:17:48 +0200
Subject: [PATCH] Fix equality operator arguments

...which avoids overload resolution ambiguities in C++20, when a synthesized
candidate of operator == for a reversed-argument rewrite conflicts with the
actual operator ==, as one is a template specialization for int and the other
for float.  (As observed with recent Clang 10 trunk with -std=c++2a when
building libstaroffice as part of LibreOffice:

> STOFFChart.cxx:230:63: error: use of overloaded operator '==' is ambiguous (with operand types 'STOFFVec2f' (aka 'STOFFVec2<float>') and 'STOFFVec2i' (aka 'STOFFVec2<int>'))
>     bool autoPlace=m_legendPosition==STOFFBox2f()||m_dimension==STOFFVec2i();
>                                                    ~~~~~~~~~~~^ ~~~~~~~~~~~~
> ./libstaroffice_internal.hxx:687:8: note: candidate function
>   bool operator==(STOFFVec2<T> const &p) const
>        ^
> ./libstaroffice_internal.hxx:687:8: note: candidate function (with reversed parameter order)
> STOFFChart.cxx:270:63: error: use of overloaded operator '==' is ambiguous (with operand types 'STOFFVec2f' (aka 'STOFFVec2<float>') and 'STOFFVec2i' (aka 'STOFFVec2<int>'))
>   bool autoPlace=m_plotAreaPosition==STOFFBox2f()||m_dimension==STOFFVec2i();
>                                                    ~~~~~~~~~~~^ ~~~~~~~~~~~~
> ./libstaroffice_internal.hxx:687:8: note: candidate function
>   bool operator==(STOFFVec2<T> const &p) const
>        ^
> ./libstaroffice_internal.hxx:687:8: note: candidate function (with reversed parameter order)

)
---
 src/lib/STOFFChart.cxx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lib/STOFFChart.cxx b/src/lib/STOFFChart.cxx
index 3e7310c..b861762 100644
--- a/src/lib/STOFFChart.cxx
+++ b/src/lib/STOFFChart.cxx
@@ -227,7 +227,7 @@ void STOFFChart::sendChart(STOFFSpreadsheetListenerPtr &listener, librevenge::RV
 
   // legend
   if (m_legend.m_show) {
-    bool autoPlace=m_legendPosition==STOFFBox2f()||m_dimension==STOFFVec2i();
+    bool autoPlace=m_legendPosition==STOFFBox2f()||m_dimension==STOFFVec2f();
     style=librevenge::RVNGPropertyList();
     m_legend.addStyleTo(style);
     style.insert("librevenge:chart-id", styleId);
@@ -267,7 +267,7 @@ void STOFFChart::sendChart(STOFFSpreadsheetListenerPtr &listener, librevenge::RV
   }
   // plot area
   style=librevenge::RVNGPropertyList();
-  bool autoPlace=m_plotAreaPosition==STOFFBox2f()||m_dimension==STOFFVec2i();
+  bool autoPlace=m_plotAreaPosition==STOFFBox2f()||m_dimension==STOFFVec2f();
   m_plotAreaStyle.addTo(style);
   style.insert("librevenge:chart-id", styleId);
   style.insert("chart:include-hidden-cells","false");
-- 
2.21.0