From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 2D6EE3951C6F for ; Tue, 23 Jun 2020 12:27:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2D6EE3951C6F Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-130-r4NiGqSnMwW5SxQX_c_pkQ-1; Tue, 23 Jun 2020 08:27:46 -0400 X-MC-Unique: r4NiGqSnMwW5SxQX_c_pkQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C6A0464; Tue, 23 Jun 2020 12:27:45 +0000 (UTC) Received: from redhat.com (ovpn-115-117.rdu2.redhat.com [10.10.115.117]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A18CA19932; Tue, 23 Jun 2020 12:27:44 +0000 (UTC) Date: Tue, 23 Jun 2020 08:27:42 -0400 From: Marek Polacek To: Nicholas Krause Cc: jason@redhat.com, gcc-patches@gcc.gnu.org Subject: Re: [PATCHv6] Handle TYPE_PACK_EXPANSION in cxx_incomplete_type_diagnostic Message-ID: <20200623122742.GE31198@redhat.com> References: <20200623014251.9468-1-xerofoify@gmail.com> <20200623020100.GD31198@redhat.com> <492d6701-2247-9fb7-0a26-8e65954d82fb@gmail.com> MIME-Version: 1.0 In-Reply-To: <492d6701-2247-9fb7-0a26-8e65954d82fb@gmail.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline X-Spam-Status: No, score=-16.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2020 12:27:49 -0000 On Mon, Jun 22, 2020 at 11:11:48PM -0400, Nicholas Krause wrote: > > > On 6/22/20 10:01 PM, Marek Polacek wrote: > > On Mon, Jun 22, 2020 at 09:42:51PM -0400, Nicholas Krause via Gcc-patches wrote: > > > From: Nicholas Krause > > > > > > This fixs the PR95672 by adding the missing TYPE_PACK_EXPANSION case in > > > cxx_incomplete_type_diagnostic in order to avoid ICES on diagnosing > > > incomplete template pack expansion cases. In v2, add the missing required > > > test case for all new patches. v3 Fixes both the test case to compile in > > > C++11 mode and the message to print out only the type. v4 fixes the testcase > > > to only target C++11. v5 and v6 fix the test case properly. > > > > > > gcc/cp/ChangeLog: > > > > > > * typeck2.c (cxx_incomplete_type_diagnostic): Add missing TYPE_EXPANSION_PACK > > > check for diagnosticing incomplete types in cxx_incomplete_type_diagnostic. > > > > It's already been pointed out to you that it's "diagnosing". > > > > > gcc/testsuite/ChangeLog: > > > > > > * g++.dg/template/PR95672.C: New test. > > > > > > Signed-off-by: Nicholas Krause > > > --- > > > gcc/cp/typeck2.c | 6 ++++++ > > > gcc/testsuite/g++.dg/template/PR95672.C | 3 +++ > > > 2 files changed, 9 insertions(+) > > > create mode 100644 gcc/testsuite/g++.dg/template/PR95672.C > > > > > > diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c > > > index 5fd3b82fa89..28b32fe0b5a 100644 > > > --- a/gcc/cp/typeck2.c > > > +++ b/gcc/cp/typeck2.c > > > @@ -552,6 +552,12 @@ cxx_incomplete_type_diagnostic (location_t loc, const_tree value, > > > TYPE_NAME (type)); > > > break; > > > + case TYPE_PACK_EXPANSION: > > > + emit_diagnostic (diag_kind, loc, 0, > > > > Bad indenting. > > Sorry seems Jason didn't catch that. > > > > > + "invalid use of pack expansion %qT", > > > + type); > > > + break; > > > + > > > case TYPENAME_TYPE: > > > case DECLTYPE_TYPE: > > > emit_diagnostic (diag_kind, loc, 0, > > > diff --git a/gcc/testsuite/g++.dg/template/PR95672.C b/gcc/testsuite/g++.dg/template/PR95672.C > > > new file mode 100644 > > > index 00000000000..fcc3da0a132 > > > --- /dev/null > > > +++ b/gcc/testsuite/g++.dg/template/PR95672.C > > > @@ -0,0 +1,3 @@ > > > +// PR c++/96572 > > > +// { dg-do compile} > > > +// { dg-options "-std=c++11" } > > > +struct g_class : decltype (auto) ... { }; // { dg-error "invalid use of pack expansion" } > > > > No, this is completely broken. It passes only because the patch file is > > malformed and the last line will be lost when applying the patch, so the > > test is an empty file. > > > > Marek > > > > Yes but now that I look at it seems the issue is that the error message was > changed. My concern is that the test will have to be updated > from the current every time the message changes like the current: > error: expected primary-expression before ‘auto’ > 1 | struct g_class : decltype (auto) ... { }; > > Is this something I should care about as seems emit_diagnostic and friends > sometimes do this. decltype(auto) is a C++14 feature so won't work with -std=c++11. Marek