According to this, void*
has no RTTI information, therefore casting from void*
is not legal and it make sense.
If I remember correctly, dynamic_cast
from void*
was working on gcc.
Can you please clarify the issue.
dynamic_cast
works only on polymorphic types, i.e. classes containing virtual functions.
In gcc you can dynamic_cast
to void*
but not from:
struct S
{
virtual ~S() {}
};
int main()
{
S* p = new S();
void* v = dynamic_cast<void*>(p);
S* p1 = dynamic_cast<S*>(v); // gives an error
}