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.
This commit is contained in:
Vadim Zeitlin
2021-04-24 19:05:11 +01:00
parent 31b983bad1
commit 5ab5172930
2 changed files with 3 additions and 2 deletions

View File

@@ -1352,7 +1352,7 @@ enum wxStretch
wxGROW = 0x2000, wxGROW = 0x2000,
wxEXPAND = wxGROW, wxEXPAND = wxGROW,
wxSHAPED = 0x4000, wxSHAPED = 0x4000,
wxTILE = wxSHAPED | wxFIXED_MINSIZE, wxTILE = 0xc000, /* wxSHAPED | wxFIXED_MINSIZE */
/* a mask to extract stretch from the combination of flags */ /* a mask to extract stretch from the combination of flags */
wxSTRETCH_MASK = 0x7000 /* sans wxTILE */ wxSTRETCH_MASK = 0x7000 /* sans wxTILE */

View File

@@ -147,7 +147,8 @@ protected:
wxDEPRECATED_MSG("useless and will be removed in the future") wxDEPRECATED_MSG("useless and will be removed in the future")
int GetDefaultTextCtrlFlag() const int GetDefaultTextCtrlFlag() const
{ {
return wxALIGN_CENTER_VERTICAL | wxRIGHT; // Cast to avoid warnings about mixing elements of different enums.
return wxALIGN_CENTER_VERTICAL | static_cast<int>(wxRIGHT);
} }
#endif // WXWIN_COMPATIBILITY_3_0 #endif // WXWIN_COMPATIBILITY_3_0