+2018-10-25 Jan Hubicka <jh@suse.cz>
+
+ * ipa-devirt.c (odr_types_equivalent_p): Do not ICE if one of types
+ is anonymous.
+
2018-10-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/87665
/* 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));
+2018-10-25 Jan Hubicka <jh@suse.cz>
+
+ * g++.dg/lto/odr-1_0.C: New test.
+ * g++.dg/lto/odr-1_1.C: New test.
+
2018-10-25 Thomas Preud'homme <thomas.preudhomme@linaro.org>
+
* gcc.dg/sibcall-9.c: Make v static.
* gcc.dg/sibcall-10.c: Likewise.
--- /dev/null
+// PR c++/82414
+// { dg-lto-do link }
+struct a { // { dg-lto-warning "8: type 'struct a' violates the C\\+\\+ One Definition Rule" }
+ struct b *ptr; // { dg-lto-message "13: the first difference of corresponding definitions is field 'ptr'" }
+};
+void test(struct a *) // { dg-lto-warning "6: warning: 'test' violates the C++ One Definition Rule" }
+{
+}
--- /dev/null
+namespace {
+ struct b;
+ }
+struct a {
+ struct b *ptr;
+};
+void test(struct a *);
+int
+main(void)
+{
+ test (0);
+}