summaryrefslogtreecommitdiff
path: root/gcc/ipa-devirt.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ipa-devirt.c')
-rw-r--r--gcc/ipa-devirt.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 9564d651b2b..466b61e5513 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -1265,6 +1265,13 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned,
/* Check first for the obvious case of pointer identity. */
if (t1 == t2)
return true;
+ if ((type_with_linkage_p (t1) && type_in_anonymous_namespace_p (t1))
+ != (type_with_linkage_p (t2) && type_in_anonymous_namespace_p (t2)))
+ {
+ warn_odr (t1, t2, NULL, NULL, warn, warned,
+ G_("one of types is in anonymous namespace while other is not"));
+ return false;
+ }
gcc_assert (!type_with_linkage_p (t1) || !type_in_anonymous_namespace_p (t1));
gcc_assert (!type_with_linkage_p (t2) || !type_in_anonymous_namespace_p (t2));