This is the mail archive of the
mailing list for the GCC project.
Re: Linker error: undefined reference to typeinfo for A with no-rtti option
Ian Lance Taylor <firstname.lastname@example.org> writes:
> Read about the key method and type_info objects here:
> I won't go into all the details, but basically if you mix -frtti and
> -fno-rtti code you need to ensure that any classes created in the
> -frtti code have their key method compiled with -frtti.
Thank you for your report.
As I understand B key method is auto generated ~B() and compiler
creates it in main compilation unit with type_info object. Even this
object never been used compiler creates it anyway. Right?
So type_info for B needs type_info for A and ask linker to find it.
Linker can't find it, because A key method and vtable was created with
And the last question: does the type_info object for B really need in
main.cpp or compiler creates it just in case?