diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-10-22 23:24:12 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-10-23 07:09:57 +0200 |
commit | 437dc68285dab0f08a1ded2193d86d64f560cd9b (patch) | |
tree | be07be10e2d5e19e3a1ff42911e458f1c571b643 /codemaker/source | |
parent | 3ed56f407235feb97ee2565a613e5f1d2bb2d925 (diff) |
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:
> vcl/unx/generic/gdi/salgdi.cxx:138:18: error: use of overloaded operator '!=' is ambiguous (with operand types 'SalX11Screen' and 'SalX11Screen')
> if( nXScreen != m_nXScreen )
> ~~~~~~~~ ^ ~~~~~~~~~~
> vcl/inc/unx/saltype.h:22:10: note: candidate function
> bool operator!=(const SalX11Screen &rOther) { return rOther.mnXScreen != mnXScreen; }
> ^
> vcl/inc/unx/saltype.h:21:10: note: candidate function
> bool operator==(const SalX11Screen &rOther) { return rOther.mnXScreen == mnXScreen; }
> ^
> vcl/inc/unx/saltype.h:21:10: note: candidate function (with reversed parameter order)
)
Change-Id: I5dab4fecfbb7badab06ebd0d779527de9672a02a
Reviewed-on: https://gerrit.libreoffice.org/81352
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'codemaker/source')
0 files changed, 0 insertions, 0 deletions