https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90909

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I think the below tweak of r271490 should be fine, it considers the bases only
when the fn isn't pure virtual:

Index: call.c
===================================================================
--- call.c      (revision 272410)
+++ call.c      (working copy)
@@ -8244,7 +8244,9 @@ build_over_call (struct z_candidate *cand, int fla
       /* See if the function member or the whole class type is declared
         final and the call can be devirtualized.  */
       if (DECL_FINAL_P (fn)
-         || CLASSTYPE_FINAL (TREE_TYPE (argtype)))
+         || CLASSTYPE_FINAL (TYPE_METHOD_BASETYPE (TREE_TYPE (fn)))
+         || (CLASSTYPE_FINAL (TREE_TYPE (argtype))
+             && !DECL_PURE_VIRTUAL_P (fn)))
        flags |= LOOKUP_NONVIRTUAL;

       /* [class.mfct.nonstatic]: If a nonstatic member function of a class

Reply via email to