* class.c (check_bases): Ignore empty bases.

From-SVN: r247816
This commit is contained in:
Jason Merrill 2017-05-09 16:38:03 -04:00 committed by Jason Merrill
parent 824c3184d7
commit c0aad6778c
3 changed files with 17 additions and 1 deletions

View File

@ -1,5 +1,7 @@
2017-05-09 Jason Merrill <jason@redhat.com>
* class.c (check_bases): Ignore empty bases.
PR c++/70979 - literal class and closure types
* class.c (finalize_literal_type_property): Handle closures
specifically.

View File

@ -1860,7 +1860,9 @@ check_bases (tree t,
members */
for (basefield = TYPE_FIELDS (basetype); basefield;
basefield = DECL_CHAIN (basefield))
if (TREE_CODE (basefield) == FIELD_DECL)
if (TREE_CODE (basefield) == FIELD_DECL
&& DECL_SIZE (basefield)
&& !integer_zerop (DECL_SIZE (basefield)))
{
if (field)
CLASSTYPE_NON_STD_LAYOUT (t) = 1;

View File

@ -0,0 +1,12 @@
// { dg-do compile { target c++11 } }
template <int> struct E { };
struct E1: E<0>, E<1> { };
struct E2: E<2>, E<3> { };
struct A1x { int n; };
struct D2: A1x, E1, E2 { };
#define SA(X) static_assert((X),#X)
SA(__is_standard_layout (D2));