Allow using noexcept methods with event tables macros
Explicitly remove noexcept before static-casting the member function pointer to the base class pointer type to avoid compilation error with C++17. Add a test checking that this does work now. Closes #18721.
This commit is contained in:
@@ -122,6 +122,9 @@ public:
|
||||
void OnEvent(wxEvent&) { g_called.method = true; }
|
||||
void OnAnotherEvent(AnotherEvent&);
|
||||
void OnIdle(wxIdleEvent&) { g_called.method = true; }
|
||||
#ifdef wxHAS_NOEXCEPT
|
||||
void OnIdleNoExcept(wxIdleEvent&) noexcept { }
|
||||
#endif
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
@@ -138,6 +141,10 @@ wxBEGIN_EVENT_TABLE(MyClassWithEventTable, wxEvtHandler)
|
||||
EVT_MYEVENT(MyClassWithEventTable::OnMyEvent)
|
||||
EVT_MYEVENT(MyClassWithEventTable::OnEvent)
|
||||
|
||||
#ifdef wxHAS_NOEXCEPT
|
||||
EVT_IDLE(MyClassWithEventTable::OnIdleNoExcept)
|
||||
#endif
|
||||
|
||||
// this shouldn't compile:
|
||||
//EVT_MYEVENT(MyClassWithEventTable::OnIdle)
|
||||
//EVT_IDLE(MyClassWithEventTable::OnAnotherEvent)
|
||||
|
Reference in New Issue
Block a user