Developer forums (C::B DEVELOPMENT STRICTLY!) > Contributions to C::B
patch vs. compile-error wxPGFlags in trunk svn13676 with wxWidgets trunk
blauzahn:
The implicit conversion of the enum is now disabled. I just added 2 static_cast instead.
--- Code: ------ trunk_20250716_vanilla/src/plugins/contrib/wxSmith/wxwidgets/properties/wxscolourproperty.cpp 2025-07-16 20:46:08.000000000 +0200
+++ trunk/src/plugins/contrib/wxSmith/wxwidgets/properties/wxscolourproperty.cpp 2025-07-16 21:39:08.141146237 +0200
@@ -205,7 +205,7 @@
else
cpv.Init( type, *wxWHITE );
- m_flags |= wxPG_PROP_STATIC_CHOICES; // Colour selection cannot be changed.
+ m_flags |= static_cast<wxPGFlags>(wxPG_PROP_STATIC_CHOICES); // Colour selection cannot be changed.
m_value << cpv;
OnSetValue();
}
@@ -583,7 +583,7 @@
int index = paintdata.m_choiceItem;
value = wxsColourValues[index];
}
- else if ( !(m_flags & (wxPGPropertyFlags)wxPG_PROP_UNSPECIFIED) )
+ else if ( !(m_flags & static_cast<wxPGFlags>(wxPG_PROP_UNSPECIFIED)) )
{
value = GetVal().m_type;
}
--- End code ---
I compiled it under Arch-Linux out-out-of tree using cmake, WX_PREFIX and --enable-pch=no as always.
Please feel free to correct trunk in a better way. Thank you for noticing this.
Miguel Gimenez:
wxPGFlags was created 4 days ago, your patch would break compilation with all current wxWidgets' releases.
Can you try casting to FlagType instead, or removing the casts completely?
blauzahn:
Unfortunately, simply casting to FlagType does not compile with wxWidgets trunk (3.3).
stahta01:
Did you try removing the cast?
blauzahn:
Yes. That does not compile either.
--- Code: ---../../../../../../../trunk/src/plugins/contrib/wxSmith/wxwidgets/properties/wxscolourproperty.cpp: In member function 'void {anonymous}::wxsMyColourPropertyClass::Init(int, const wxColour&)':
../../../../../../../trunk/src/plugins/contrib/wxSmith/wxwidgets/properties/wxscolourproperty.cpp:209:17: error: no match for 'operator|=' (operand types are 'wxPGFlags' and 'const int')
209 | m_flags |= wxPG_PROP_STATIC_CHOICES; // Colour selection cannot be changed.
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../../../trunk/src/plugins/contrib/wxSmith/wxwidgets/properties/wxscolourproperty.cpp:209:17: note: there is 1 candidate
In file included from /opt/wx/include/wx-3.3/wx/propgrid/propgrid.h:21,
from ../../../../../../../trunk/src/plugins/contrib/wxSmith/wxwidgets/properties/../../properties/wxsproperty.h:34,
from ../../../../../../../trunk/src/plugins/contrib/wxSmith/wxwidgets/properties/../../properties/wxsproperties.h:8,
from ../../../../../../../trunk/src/plugins/contrib/wxSmith/wxwidgets/properties/wxscolourproperty.h:28,
from ../../../../../../../trunk/src/plugins/contrib/wxSmith/wxwidgets/properties/wxscolourproperty.cpp:23:
/opt/wx/include/wx-3.3/wx/propgrid/property.h:423:18: note: candidate 1: 'wxPGFlags operator|=(wxPGFlags&, wxPGFlags)'
423 | inline wxPGFlags operator|=(wxPGFlags & a, wxPGFlags b)
| ^~~~~~~~
/opt/wx/include/wx-3.3/wx/propgrid/property.h:423:54: note: no known conversion for argument 2 from 'const int' to 'wxPGFlags'
423 | inline wxPGFlags operator|=(wxPGFlags & a, wxPGFlags b)
| ~~~~~~~~~~^
../../../../../../../trunk/src/plugins/contrib/wxSmith/wxwidgets/properties/wxscolourproperty.cpp: In member function 'virtual void {anonymous}::wxsMyColourPropertyClass::OnCustomPaint(wxDC&, const wxRect&, wxPGPaintData&)':
../../../../../../../trunk/src/plugins/contrib/wxSmith/wxwidgets/properties/wxscolourproperty.cpp:587:29: error: no match for 'operator&' (operand types are 'wxPGFlags' and 'wxPG_EX_WINDOW_STYLES')
587 | else if ( !(m_flags & wxPG_PROP_UNSPECIFIED) )
| ~~~~~~~ ^
| |
| wxPGFlags
../../../../../../../trunk/src/plugins/contrib/wxSmith/wxwidgets/properties/wxscolourproperty.cpp:587:29: note: there is 1 candidate
587 | else if ( !(m_flags & wxPG_PROP_UNSPECIFIED) )
/opt/wx/include/wx-3.3/wx/propgrid/property.h:428:21: note: candidate 1: 'constexpr wxPGFlags operator&(wxPGFlags, wxPGFlags)'
428 | constexpr wxPGFlags operator&(wxPGFlags a, wxPGFlags b)
| ^~~~~~~~
/opt/wx/include/wx-3.3/wx/propgrid/property.h:428:54: note: no known conversion for argument 2 from 'wxPG_EX_WINDOW_STYLES' to 'wxPGFlags'
428 | constexpr wxPGFlags operator&(wxPGFlags a, wxPGFlags b)
| ~~~~~~~~~~^
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version