https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70594
--- Comment #44 from Richard Biener <rguenth at gcc dot gnu.org> --- Index: gcc/ipa-polymorphic-call.c =================================================================== --- gcc/ipa-polymorphic-call.c (revision 234971) +++ gcc/ipa-polymorphic-call.c (working copy) @@ -485,6 +485,9 @@ contains_type_p (tree outer_type, HOST_W tree inlined_polymorphic_ctor_dtor_block_p (tree block, bool check_clones) { + if (! inlined_function_outer_scope_p (block)) + return NULL_TREE; + tree fn = block_ultimate_origin (block); if (fn == NULL || TREE_CODE (fn) != FUNCTION_DECL) return NULL_TREE;