From 6876b269bc7fe6465fedfed87c31e6175992129f Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 4 Mar 2020 12:08:42 -0500 Subject: 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 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. --- gcc/cp/constexpr.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/cp/constexpr.c') 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)) { -- cgit v1.1