class.c (is_really_empty_class): A zero-length array is empty.
* class.c (is_really_empty_class): A zero-length array is empty. An unnamed bit-field doesn't make a class non-empty. From-SVN: r234916
This commit is contained in:
parent
6512fa6dc0
commit
08d6d8bb00
2 changed files with 9 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
2016-04-12 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* class.c (is_really_empty_class): A zero-length array is empty.
|
||||
An unnamed bit-field doesn't make a class non-empty.
|
||||
|
||||
2016-04-12 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/68722
|
||||
|
|
|
@ -8406,12 +8406,15 @@ is_really_empty_class (tree type)
|
|||
for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
|
||||
if (TREE_CODE (field) == FIELD_DECL
|
||||
&& !DECL_ARTIFICIAL (field)
|
||||
/* An unnamed bit-field is not a data member. */
|
||||
&& (DECL_NAME (field) || !DECL_C_BIT_FIELD (field))
|
||||
&& !is_really_empty_class (TREE_TYPE (field)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
else if (TREE_CODE (type) == ARRAY_TYPE)
|
||||
return is_really_empty_class (TREE_TYPE (type));
|
||||
return (integer_zerop (array_type_nelts_top (type))
|
||||
|| is_really_empty_class (TREE_TYPE (type)));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue