GCC 10.2: undefined reference to vtable: missing its key function
Jonathan Wakely
jwakely@redhat.com
Tue Jun 8 11:45:39 GMT 2021
(This should have been on the gcc-help list.)
> I may be remembering wrong, but -- doesn't dynamic_cast look for a vtable?
It uses a vtable if one is present, it can't cause one to be
introduced, so ...
>So if you do a dynamic cast mentioning that class you'd get such a reference.
No.
> Or is that an error when applied to a non-polymorphic class?
You can use dynamic_cast to upcast (i.e. from derived to base) for
non-polymorphic class types. It is an error to downcast (from base to
derived) for a non-polymorphic class type.
More information about the Gcc
mailing list