[Bug c++/95976] [[no_unique_address]] on union members has the opposite-of-intended effect
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jul 10 12:36:23 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95976
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:3bb330022ce47a3e8966a9930f392e497c608f59
commit r10-8456-g3bb330022ce47a3e8966a9930f392e497c608f59
Author: Jason Merrill <jason@redhat.com>
Date: Thu Jul 9 15:11:12 2020 -0400
c++: [[no_unique_address]] fixes. [PR96105]
We were wrongly checking is_empty_class on the result of strip_array_types
rather than the actual field type. We weren't considering the alignment of
the data member. We needed to handle unions the same way as
layout_nonempty_base_or_field.
gcc/cp/ChangeLog:
PR c++/96105
PR c++/96052
PR c++/95976
* class.c (check_field_decls): An array of empty classes is not an
empty data member.
(layout_empty_base_or_field): Handle explicit alignment.
Fix union handling.
gcc/testsuite/ChangeLog:
PR c++/96105
PR c++/96052
PR c++/95976
* g++.dg/cpp2a/no_unique_address4.C: New test.
* g++.dg/cpp2a/no_unique_address5.C: New test.
* g++.dg/cpp2a/no_unique_address6.C: New test.
More information about the Gcc-bugs
mailing list