https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89358
--- Comment #13 from Jan Hubicka <hubicka at gcc dot gnu.org> --- I am testing the following: Index: ipa-devirt.c =================================================================== --- ipa-devirt.c (revision 270280) +++ ipa-devirt.c (working copy) @@ -1282,6 +1282,22 @@ warn_types_mismatch (tree t1, tree t2, l inform (loc_t2, "the incompatible type is defined here"); } +static bool +skip_in_fields_list_p (tree t) +{ + if (TREE_CODE (t) != FIELD_DECL) + return true; + /* C++ FE itroduces zero sized fields depending on -mstd setting, see + PR89358. */ + if (DECL_SIZE (t) + && integer_zerop (DECL_SIZE (t)) + && DECL_ARTIFICIAL (t) + && DECL_IGNORED_P (t) + && !DECL_NAME (t)) + return true; + return false; +} + /* Compare T1 and T2, report ODR violations if WARN is true and set WARNED to true if anything is reported. Return true if types match. If true is returned, the types are also compatible in the sense of @@ -1547,10 +1563,9 @@ odr_types_equivalent_p (tree t1, tree t2 f1 || f2; f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2)) { - /* Skip non-fields. */ - while (f1 && TREE_CODE (f1) != FIELD_DECL) + while (f1 && skip_in_fields_list_p (f1)) f1 = TREE_CHAIN (f1); - while (f2 && TREE_CODE (f2) != FIELD_DECL) + while (f2 && skip_in_fields_list_p (f2)) f2 = TREE_CHAIN (f2); if (!f1 || !f2) break;