diff options
author | Jason Merrill <jason@redhat.com> | 2020-03-04 12:08:42 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-03-04 17:32:10 -0500 |
commit | 6876b269bc7fe6465fedfed87c31e6175992129f (patch) | |
tree | 932e196928b06bdf75240404f18593556310a575 /gcc/cp/constexpr.c | |
parent | 10bbbb591cfe6cac200e926a73f3b8065147ce84 (diff) | |
download | gcc-6876b269bc7fe6465fedfed87c31e6175992129f.zip gcc-6876b269bc7fe6465fedfed87c31e6175992129f.tar.gz gcc-6876b269bc7fe6465fedfed87c31e6175992129f.tar.bz2 |
c++: Fix [[no_unique_address]] and default mem-init [PR90432]
output_constructor doesn't like two consecutive entries with fields at the
same position; let's avoid adding the one for the empty field.
gcc/cp/ChangeLog
2020-03-04 Jason Merrill <jason@redhat.com>
PR c++/90432
* init.c (perform_member_init): Don't do aggregate initialization of
empty field.
* constexpr.c (cx_check_missing_mem_inits): Don't enforce
initialization of empty field.
Diffstat (limited to 'gcc/cp/constexpr.c')
-rw-r--r-- | gcc/cp/constexpr.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index c2d4460..521c87f 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -831,6 +831,9 @@ cx_check_missing_mem_inits (tree ctype, tree body, bool complain) /* A flexible array can't be intialized here, so don't complain that it isn't. */ continue; + if (DECL_SIZE (field) && integer_zerop (DECL_SIZE (field))) + /* An empty field doesn't need an initializer. */ + continue; ftype = strip_array_types (ftype); if (type_has_constexpr_default_constructor (ftype)) { |