Дмитрий Оксенчук <oksenchuk89@xxxxxxxxx> writes: > Ian Lance Taylor <iant@xxxxxxxxxx> writes: >> Read about the key method and type_info objects here: >> >> http://gcc.gnu.org/onlinedocs/gcc/Vague-Linkage.html >> >> 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 > -fno-rtti. > > And the last question: does the type_info object for B really need in > main.cpp or compiler creates it just in case? The compiler is creating the virtual table for B in main.cpp, so it needs to create the type_info object also. If you compile code without using -fno-rtti, then the compiler always adds typinfo information to virtual tables. Ian