C++ compilers warn if pure virtual functions are directly called in a constructor/destructor (but not indirectly).
Binding a pure virtual function and storing the result in a class member and calling that member all from the same constructor is just a pure virtual call with extra steps.
In this context, std::bind has the advantage that the compiler (or STL) has all the information it needs to do the check: it has the member function pointer and it knows it's in a constructor.
If one could convert std::bind into a macro that inserts a call to the pure virtual function before returning the bind result, it would allow for statically checking against binding pure virtual functions in a codebase. But apparently one can't just call &SomeClass::func(this, placeholders::_1, placeholders::_2, etc) in a macro.
Is there a way to get the compiler to warn that a member function pointer is pure virtual without it being actually called from the constructor ?
std::bindby equivalent lambda functions..&SomeClass::func(this, placeholders::_1, placeholders::_2, etc)is just wrong syntax for a member function call. But regardless, how would that help you? Do you want all uses of bind in your program to implicitly cause a call to the function that is being bound? Surely that's not correct behavior...