Prepare for removal of non-const operator[] from Sequence in codemaker
[LibreOffice.git] / external / firebird / 0001-Make-comparison-operator-member-functions-const.patch.1
blob42c677f7e5addb05071de2b06a1cf7e1f414385f
1 From 15390d75ee6ca429dbbe15ea04214df8a30fbd48 Mon Sep 17 00:00:00 2001
2 From: Stephan Bergmann <sbergman@redhat.com>
3 Date: Mon, 21 Oct 2019 17:54:18 +0200
4 Subject: [PATCH] Make comparison operator member functions const
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 ==, due to the asymmetric const-ness of the implicit object
9 parameter and the RHS parameter.  (As observed with recent Clang 10 trunk with
10 -std=c++2a when building firebird as part of LibreOffice:
12 > workdir/UnpackedTarball/firebird/src/jrd/inf.cpp:1139:62: error: use of overloaded operator '!=' is ambiguous (with operand types 'RuntimeStatistics::Iterator' and 'Jrd::RuntimeStatistics::Iterator')
13 >         for (RuntimeStatistics::Iterator iter = stats.begin(); iter != stats.end(); ++iter)
14 >                                                                ~~~~ ^  ~~~~~~~~~~~
15 > workdir/UnpackedTarball/firebird/src/jrd/../dsql/../jrd/RuntimeStatistics.h:283:8: note: candidate function
16 >                 bool operator!=(const Iterator& other)
17 >                      ^
18 > workdir/UnpackedTarball/firebird/src/jrd/../dsql/../jrd/RuntimeStatistics.h:278:8: note: candidate function
19 >                 bool operator==(const Iterator& other)
20 >                      ^
21 > workdir/UnpackedTarball/firebird/src/jrd/../dsql/../jrd/RuntimeStatistics.h:278:8: note: candidate function (with reversed parameter order)
24 ---
25  src/jrd/RuntimeStatistics.h | 4 ++--
26  1 file changed, 2 insertions(+), 2 deletions(-)
28 diff --git a/src/jrd/RuntimeStatistics.h b/src/jrd/RuntimeStatistics.h
29 index 74a03de2ad..fab286ad1a 100644
30 --- a/src/jrd/RuntimeStatistics.h
31 +++ b/src/jrd/RuntimeStatistics.h
32 @@ -290,12 +290,12 @@ public:
33                 {}
35         public:
36 -               bool operator==(const Iterator& other)
37 +               bool operator==(const Iterator& other) const
38                 {
39                         return (m_counts == other.m_counts);
40                 }
42 -               bool operator!=(const Iterator& other)
43 +               bool operator!=(const Iterator& other) const
44                 {
45                         return (m_counts != other.m_counts);
46                 }
47 -- 
48 2.21.0