https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65475
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> --- Unfortunately, there is another problem with applied patch: $ cat 1.ii namespace std { class exception {}; class runtime_error : exception { virtual char m_fn1(); } a; } $ cat 2.ii namespace std { class exception { virtual char m_fn1(); }; class runtime_error : exception { } a; } $ g++ 1.ii 2.ii -flto -O1 /home/marxin/Programming/bin/gcc/bin/ld: error: /tmp/cc7v39VO.o: multiple definition of 'std::a' /home/marxin/Programming/bin/gcc/bin/ld: /tmp/ccJ8pPM4.o: previous definition here 2.ii:2:7: warning: type ‘struct exception’ violates one definition rule [-Wodr] class exception { ^ 1.ii:2:7: note: a type with different virtual table pointers is defined in another translation unit class exception {}; ^ 2.ii:2:7: warning: type ‘struct exception’ violates one definition rule [-Wodr] class exception { ^ 1.ii:2:7: note: a type with different bases is defined in another translation unit class exception {}; ^ 1.ii:3:7: warning: type ‘struct runtime_error’ violates one definition rule [-Wodr] class runtime_error : exception { ^ 2.ii:5:7: note: a type with different virtual table pointers is defined in another translation unit class runtime_error : exception { ^ lto1: internal compiler error: in add_type_duplicate, at ipa-devirt.c:1575 0x77c43c add_type_duplicate ../../gcc/ipa-devirt.c:1573 0x77c43c get_odr_type(tree_node*, bool) ../../gcc/ipa-devirt.c:1772 0x77d25c register_odr_type(tree_node*) ../../gcc/ipa-devirt.c:1848 0x5b43d6 lto_read_decls ../../gcc/lto/lto.c:1946 0x5b4d7b lto_file_finalize ../../gcc/lto/lto.c:2236 0x5b4d7b lto_create_files_from_ids ../../gcc/lto/lto.c:2246 0x5b4d7b lto_file_read ../../gcc/lto/lto.c:2287 0x5b4d7b read_cgraph_and_symbols ../../gcc/lto/lto.c:2992 0x5b4d7b lto_main() ../../gcc/lto/lto.c:3462 Thanks, Martin