From 5ab5172930d3552b6c15459e71e315ee84530625 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 24 Apr 2021 19:05:11 +0100 Subject: [PATCH] Avoid warnings about mixing different enums with C++20 C++20 deprecates arithmetic operations with the elements of different enums and at least clang 10 and MSVS 2019 already warn about this when compiling in C++20 mode, so avoid such operations at least in the public headers to avoid warnings in the applications using wxWidgets and C++20. --- include/wx/defs.h | 2 +- include/wx/pickerbase.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index c4dd777540..d98dac5354 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -1352,7 +1352,7 @@ enum wxStretch wxGROW = 0x2000, wxEXPAND = wxGROW, wxSHAPED = 0x4000, - wxTILE = wxSHAPED | wxFIXED_MINSIZE, + wxTILE = 0xc000, /* wxSHAPED | wxFIXED_MINSIZE */ /* a mask to extract stretch from the combination of flags */ wxSTRETCH_MASK = 0x7000 /* sans wxTILE */ diff --git a/include/wx/pickerbase.h b/include/wx/pickerbase.h index a4af0a629c..5966cab5d9 100644 --- a/include/wx/pickerbase.h +++ b/include/wx/pickerbase.h @@ -147,7 +147,8 @@ protected: wxDEPRECATED_MSG("useless and will be removed in the future") int GetDefaultTextCtrlFlag() const { - return wxALIGN_CENTER_VERTICAL | wxRIGHT; + // Cast to avoid warnings about mixing elements of different enums. + return wxALIGN_CENTER_VERTICAL | static_cast(wxRIGHT); } #endif // WXWIN_COMPATIBILITY_3_0