The main reason is because there is no requirement that
a pointer to member have the same size and representation as
a pointer to data. In practice, it's hard to imagine a pointer
to a data member not being able to fit into a void*
, since
a pointer to a data member really only needs to contain an
offset. Roughly speaking, a pointer to a data member will
never need to be larger than a size_t
, and a void*
must be
at least as large as a size_t
. On the other hand, it could
easily contain bit patterns which weren't legal in a pointer.
In fact, as Steve Jessop points out, pointers to member do require additional information, since if the member is in a virtual base, its offset depends on the most derived class, and must be calculated dynamically, based on additional information in the pointer.
More generally, a void*
can only contain a pointer to data.
It must be as large as the largest data pointer (typically
a char*
), but pointers to functions, and member pointers, can
be larger, and not fit (and pointer to member functions almost
never fit).