From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116309 invoked by alias); 25 May 2017 08:51:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 116289 invoked by uid 89); 25 May 2017 08:51:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 May 2017 08:51:57 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 21C9581F01 for ; Thu, 25 May 2017 08:52:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 21C9581F01 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jakub@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 21C9581F01 Received: from tucnak.zalov.cz (unknown [10.36.118.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B78D05C540; Thu, 25 May 2017 08:51:59 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id v4P8pvUX019295; Thu, 25 May 2017 10:51:57 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v4P8pueU019294; Thu, 25 May 2017 10:51:56 +0200 Date: Thu, 25 May 2017 09:08:00 -0000 From: Jakub Jelinek To: Jason Merrill Cc: gcc-patches List Subject: Re: C++ PATCH for testsuite failures with -std=c++17 Message-ID: <20170525085156.GY8499@tucnak> Reply-To: Jakub Jelinek References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg01931.txt.bz2 On Tue, May 09, 2017 at 04:37:16PM -0400, Jason Merrill wrote: > For C++17 aggregate bases, we have started adding base fields for > empty bases. The code for calculating whether a class is standard > layout needs to ignore these. > > The C++17 mode diagnostic for direct-enum-init1.C was incorrect. > > Tested x86_64-pc-linux-gnu, applying to trunk. > commit 9a612cc30d4b3ef905ce45304545d8b99a3cf5b9 > Author: Jason Merrill > Date: Tue May 9 14:15:38 2017 -0400 > > * class.c (check_bases): Ignore empty bases. This should have referenced PR c++/80605 (and is also a 7 regression). > diff --git a/gcc/cp/class.c b/gcc/cp/class.c > index fc71766..085dbc3 100644 > --- a/gcc/cp/class.c > +++ b/gcc/cp/class.c > @@ -1860,7 +1860,9 @@ check_bases (tree t, > members */ > for (basefield = TYPE_FIELDS (basetype); basefield; > basefield = DECL_CHAIN (basefield)) > - if (TREE_CODE (basefield) == FIELD_DECL) > + if (TREE_CODE (basefield) == FIELD_DECL > + && DECL_SIZE (basefield) > + && !integer_zerop (DECL_SIZE (basefield))) Is that what we really want? I mean, shouldn't we at least also check that the basefield we want to ignore is DECL_ARTIFICIAL, or that it doesn't have DECL_NAME or something similar, to avoid considering user fields with zero size the same? I believe your change changes e.g.: struct S { int a[0]; }; struct T : public S { int b[0]; int c; }; bool q = __is_standard_layout (T); which previously e.g. with -std=gnu++14 emitted q = false, but now emits q = true. Jakub