Expected: OnEvent remains a non-static member, registration requires a void (Receiver::*)(int), while a static method produces a different
function-pointer type.
Actual
when Cppcheck analyzes the header by itself:
scratch_functionStatic_callback.h:6:9: style: The member function 'CallbackReceiver::OnEvent' can be static. [functionStatic]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For the record, these warnings appear when cppcheck only analyzes the header & not the translation unit. So maybe not really a defect but just how it goes...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Minimal reproduction:
scratch_functionStatic_callback.h:scratch_functionStatic_callback.cpp:Expected
OnEventremains a non-static member, registration requires avoid (Receiver::*)(int), while a static method produces a differentfunction-pointer type.
Actual
when Cppcheck analyzes the header by itself:
scratch_functionStatic_callback.h:6:9: style: The member function 'CallbackReceiver::OnEvent' can be static. [functionStatic]For the record, these warnings appear when cppcheck only analyzes the header & not the translation unit. So maybe not really a defect but just how it goes...