aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-04-12 16:28:40 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-04-12 16:28:40 -0400
commit08d6d8bb00d6feddc6916739276aeea4600cd188 (patch)
tree37b2cb3f76981302d20b8a4126690544dc198be1 /gcc
parent6512fa6dc09a8de843d9d4921d9e8f717dec5a80 (diff)
downloadgcc-08d6d8bb00d6feddc6916739276aeea4600cd188.zip
gcc-08d6d8bb00d6feddc6916739276aeea4600cd188.tar.gz
gcc-08d6d8bb00d6feddc6916739276aeea4600cd188.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/class.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 88b6a10..823ab11 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index e66f0b9..02a992f 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -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;
}