From ffc3168f6f726195831bc00acc3d835e5970e72d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 25 Apr 2021 18:46:33 +0200 Subject: [PATCH] Make wxFontBase::operator==() symmetric by taking wxFontBase Taking wxFont here resulted in a potential ambiguity when comparing wxFont objects, at least according to clang 12 in C++20 mode. Avoid this by just taking wxFontBase here, as now the operator is fully symmetric, rather than exactly matching only (wxFontBase, wxFont) and matching (wxFont, wxFont) either directly or with reversed arguments order. --- include/wx/font.h | 4 ++-- src/common/fontcmn.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/wx/font.h b/include/wx/font.h index 938e6aeaf1..428840d3b3 100644 --- a/include/wx/font.h +++ b/include/wx/font.h @@ -395,8 +395,8 @@ public: #endif // wxUSE_PRIVATE_FONTS // comparison - bool operator==(const wxFont& font) const; - bool operator!=(const wxFont& font) const { return !(*this == font); } + bool operator==(const wxFontBase& font) const; + bool operator!=(const wxFontBase& font) const { return !(*this == font); } // accessors: get the font characteristics virtual int GetPointSize() const; diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index 3ae09d0f49..96082ed375 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -425,7 +425,7 @@ bool wxFontBase::SetNativeFontInfoUserDesc(const wxString& info) return false; } -bool wxFontBase::operator==(const wxFont& font) const +bool wxFontBase::operator==(const wxFontBase& font) const { // either it is the same font, i.e. they share the same common data or they // have different ref datas but still describe the same font