MyObject->MyFunc
, as the error says, cannot be used for anything except an immediate function call. You can’t even take its sizeof
, even if some compilers allow that. I think what you mean is sizeof(&ClassName::FunctionName)
. That’s simpler, will actually compile, and doesn’t invoke undefined behavior (dereferencing a null pointer is UB, even if you don’t do anything with the dereferenced result).
5
solved Very disturbing error message