https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80605
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- check_bases does: /* ...either has no non-static data members in the most-derived class and at most one base class with non-static data members, or has no base classes with non-static data members */ for (basefield = TYPE_FIELDS (basetype); basefield; basefield = DECL_CHAIN (basefield)) if (TREE_CODE (basefield) == FIELD_DECL) { if (field) CLASSTYPE_NON_STD_LAYOUT (t) = 1; else field = basefield; break; } and we hit this with field being x and basefield being the artificial FIELD_DECL created from: 4615 /* We used to not create a FIELD_DECL for empty base classes because of 4616 back end issues with overlapping FIELD_DECLs, but that doesn't seem to 4617 be a problem anymore. We need them to handle initialization of C++17 4618 aggregate bases. */ 4619 if (cxx_dialect >= cxx1z && !BINFO_VIRTUAL_P (binfo)) 4620 { 4621 tree decl = build_base_field_1 (t, basetype, next_field); 4622 DECL_FIELD_OFFSET (decl) = BINFO_OFFSET (binfo); 4623 DECL_FIELD_BIT_OFFSET (decl) = bitsize_zero_node; 4624 SET_DECL_OFFSET_ALIGN (decl, BITS_PER_UNIT); 4625 } So, do we need to ignore those artificial FIELD_DECLs in the CLASSTYPE_NON_STD_LAYOUT computation? Do we have some way how to identify the FIELD_DECLs created in this case?