summaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 320a343da0d..caffa59d015 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -13262,7 +13262,15 @@ verify_type (const_tree t)
}
}
-
+ /* ipa-devirt makes an assumption that TYPE_METHOD_BASETYPE is always
+ TYPE_MAIN_VARIANT and it would be odd to add methods only to variatns
+ of a type. */
+ if (TREE_CODE (t) == METHOD_TYPE
+ && TYPE_MAIN_VARIANT (TYPE_METHOD_BASETYPE (t)) != TYPE_METHOD_BASETYPE (t))
+ {
+ error ("TYPE_METHOD_BASETYPE is not main variant");
+ error_found = true;
+ }
if (error_found)
{