The operator precedence of .*
and ->*
is, IMHO, broken. You need to wrap the operands in parentheses in order to call.
return (this->*MyFunc)(a);
Otherwise, the compiler thinks you're doing this->*(MyFunc(a))
, which is obviously invalid.
Interestingly enough, (this->*MyFunc)
as a standalone expression is also invalid. It needs to be called on the spot.