]> gcc.gnu.org Git - gcc.git/commit
PR c++/89089 - ICE with [[no_unique_address]].
authorJason Merrill <jason@redhat.com>
Tue, 29 Jan 2019 15:39:40 +0000 (10:39 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 29 Jan 2019 15:39:40 +0000 (10:39 -0500)
commit7e574f68fa82e7c5f879fd468291ec8b5ebecc83
tree1f21833e2d6af54eca9bc56c95e022c7ebb25c54
parent6065f1c5889159c9fa1b6c74726d04fc9abea9fe
PR c++/89089 - ICE with [[no_unique_address]].

In 89089, we were never actually setting DECL_SIZE on an empty data member,
because its type is a POD, so we didn't set it in the maybe-overlapping
section.  Fixed by also handling empty types there.

In 88865, we were failing to consider empty data members in
include_empty_classes.  Fixed by making end_of_class always include them.

While looking at these I noticed that the ABI says that a
potentially-overlapping data member makes its class non-layout-POD, and that
an empty data member doesn't prevent its class from being empty, so I've
implemented those points as well.

PR c++/88865 - wrong layout with [[no_unique_address]].
* class.c (check_field_decls): A potentially-overlapping field makes
the class non-layout-POD, but not non-empty.
(end_of_class): Always consider empty data members.
(layout_class_type): Set DECL_SIZE for empty fields.

From-SVN: r268368
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/g++.dg/abi/no_unique_address4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/abi/no_unique_address5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/no_unique_address2.C [new file with mode: 0644]
This page took 0.054752 seconds and 5 git commands to generate.