vcl/inc/unx/saltype.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
New commits: commit 437dc68285dab0f08a1ded2193d86d64f560cd9b Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Oct 22 23:24:12 2019 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Wed Oct 23 07:09:57 2019 +0200 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 <sberg...@redhat.com> diff --git a/vcl/inc/unx/saltype.h b/vcl/inc/unx/saltype.h index 97d9f1a4bb93..e62bdd25e1e2 100644 --- a/vcl/inc/unx/saltype.h +++ b/vcl/inc/unx/saltype.h @@ -18,8 +18,8 @@ class SalX11Screen { public: explicit SalX11Screen(unsigned int nXScreen) : mnXScreen( nXScreen ) {} unsigned int getXScreen() const { return mnXScreen; } - bool operator==(const SalX11Screen &rOther) { return rOther.mnXScreen == mnXScreen; } - bool operator!=(const SalX11Screen &rOther) { return rOther.mnXScreen != mnXScreen; } + bool operator==(const SalX11Screen &rOther) const { return rOther.mnXScreen == mnXScreen; } + bool operator!=(const SalX11Screen &rOther) const { return rOther.mnXScreen != mnXScreen; } }; #endif // INCLUDED_VCL_INC_UNX_SALTYPE_H _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits