1 From 9c0ff663659a28720c4ee3f5752bb8ce8121648f Mon Sep 17 00:00:00 2001
2 From: Stephan Bergmann <sbergman@redhat.com>
3 Date: Mon, 21 Oct 2019 17:17:48 +0200
4 Subject: [PATCH] Fix equality operator arguments
6 ...which avoids overload resolution ambiguities in C++20, when a synthesized
7 candidate of operator == for a reversed-argument rewrite conflicts with the
8 actual operator ==, as one is a template specialization for int and the other
9 for float. (As observed with recent Clang 10 trunk with -std=c++2a when
10 building libstaroffice as part of LibreOffice:
12 > STOFFChart.cxx:230:63: error: use of overloaded operator '==' is ambiguous (with operand types 'STOFFVec2f' (aka 'STOFFVec2<float>') and 'STOFFVec2i' (aka 'STOFFVec2<int>'))
13 > bool autoPlace=m_legendPosition==STOFFBox2f()||m_dimension==STOFFVec2i();
14 > ~~~~~~~~~~~^ ~~~~~~~~~~~~
15 > ./libstaroffice_internal.hxx:687:8: note: candidate function
16 > bool operator==(STOFFVec2<T> const &p) const
18 > ./libstaroffice_internal.hxx:687:8: note: candidate function (with reversed parameter order)
19 > STOFFChart.cxx:270:63: error: use of overloaded operator '==' is ambiguous (with operand types 'STOFFVec2f' (aka 'STOFFVec2<float>') and 'STOFFVec2i' (aka 'STOFFVec2<int>'))
20 > bool autoPlace=m_plotAreaPosition==STOFFBox2f()||m_dimension==STOFFVec2i();
21 > ~~~~~~~~~~~^ ~~~~~~~~~~~~
22 > ./libstaroffice_internal.hxx:687:8: note: candidate function
23 > bool operator==(STOFFVec2<T> const &p) const
25 > ./libstaroffice_internal.hxx:687:8: note: candidate function (with reversed parameter order)
29 src/lib/STOFFChart.cxx | 4 ++--
30 1 file changed, 2 insertions(+), 2 deletions(-)
32 diff --git a/src/lib/STOFFChart.cxx b/src/lib/STOFFChart.cxx
33 index 3e7310c..b861762 100644
34 --- a/src/lib/STOFFChart.cxx
35 +++ b/src/lib/STOFFChart.cxx
36 @@ -227,7 +227,7 @@ void STOFFChart::sendChart(STOFFSpreadsheetListenerPtr &listener, librevenge::RV
39 if (m_legend.m_show) {
40 - bool autoPlace=m_legendPosition==STOFFBox2f()||m_dimension==STOFFVec2i();
41 + bool autoPlace=m_legendPosition==STOFFBox2f()||m_dimension==STOFFVec2f();
42 style=librevenge::RVNGPropertyList();
43 m_legend.addStyleTo(style);
44 style.insert("librevenge:chart-id", styleId);
45 @@ -267,7 +267,7 @@ void STOFFChart::sendChart(STOFFSpreadsheetListenerPtr &listener, librevenge::RV
48 style=librevenge::RVNGPropertyList();
49 - bool autoPlace=m_plotAreaPosition==STOFFBox2f()||m_dimension==STOFFVec2i();
50 + bool autoPlace=m_plotAreaPosition==STOFFBox2f()||m_dimension==STOFFVec2f();
51 m_plotAreaStyle.addTo(style);
52 style.insert("librevenge:chart-id", styleId);
53 style.insert("chart:include-hidden-cells","false");