https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104419

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
>From what I can see, the reason why tuple2<int, empty> is not std-layout is
https://eel.is/c++draft/class.prop#3.6
checked in:
            /* ...has all non-static data members and bit-fields in the class
               and its base classes first declared in the same class.  */
            for (basefield = TYPE_FIELDS (basetype); basefield;
                 basefield = DECL_CHAIN (basefield))
              if (TREE_CODE (basefield) == FIELD_DECL
                  && !(DECL_FIELD_IS_BASE (basefield)
                       && is_empty_field (basefield)))
                {
                  if (field)
                    CLASSTYPE_NON_STD_LAYOUT (t) = 1;
                  else
                    field = basefield;
                  break;
                }
basefield is t with int type, field is t with empty type and we haven't ignored
the latter because while is_empty_field is true on it, it isn't
DECL_FIELD_IS_BASE.

Reply via email to