http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58678
--- Comment #18 from Jan Hubicka <hubicka at gcc dot gnu.org> --- It is a speculative devirtualization; we see no other option than B, so we try to inline it. Speculative devirtualization already has logic in it so it won't pick method without definition (it also will pick if the method is const/pure, I can change that) Here we have extern inline function with a definition so speculative devirtualization is happy and inline it. I don't think we should be checking at devirtualization time if the inlined function has refernce to something external or not. So I would say that C++ FE should not produce extern inlines that can not be inlined after all or better mark them UNINLINABLE so they can be used for side effects analysis. Or perhaps we can extend tree_inlinable_function_p this way? Honza