* class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL.
If we have a pointer to final class, we know the dynamic type of the object
must be that class, because it can't have any derived classes.
From-SVN: r272656
+2019-06-25 Jason Merrill <jason@redhat.com>
+
+ * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL.
+
2019-06-25 Jakub Jelinek <jakub@redhat.com>
PR c++/90969
}
fixed = fixed_type_or_null (instance, nonnull, &cdtorp);
- if (fixed == NULL_TREE)
- return 0;
if (INDIRECT_TYPE_P (t))
t = TREE_TYPE (t);
+ if (CLASS_TYPE_P (t) && CLASSTYPE_FINAL (t))
+ return 1;
+ if (fixed == NULL_TREE)
+ return 0;
if (!same_type_ignoring_top_level_qualifiers_p (t, fixed))
return 0;
return cdtorp ? -1 : 1;
--- /dev/null
+// { dg-do compile { target c++11 } }
+// { dg-additional-options -fdump-tree-gimple }
+// { dg-final { scan-tree-dump-not "vptr" gimple } }
+
+struct A { int i; };
+struct B final: public virtual A { int j; };
+
+int f(B* b) { return b->i; }