From patchwork Mon Nov 26 20:49:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1003480 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-490916-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="hrg5il6Q"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 433fDX0bLdz9s6w for ; Tue, 27 Nov 2018 07:49:47 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=LV120xgK7rMDi9WHz6w35+0fAFKTh DGM3HFhGg3I1YEY2PaICLu3QllFnUUMt+f9Qi3rcjX9NAHZnbjBfy/Ir4j2i1x6B L4iUIx4FVtjeJj95b+k1T270sZswbF+JgAHyOGL2zQBmGxNf5IbQbz6y+I+7YOk2 gvEXGJfaHpj5J8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=zl/AzGZaVPS0opssMpFLHzi9pjU=; b=hrg 5il6QlveusPWg+haueU8ZG2w704a32+6s2VxkzFfBYoZ043iejLTFKLLrhWtpdgu t/sxZyyhoFonZiAgfiroNcD/sDjNhu2n3F8bdHrd4Q6VWaFc3ye+SBNJtTLZHyIa n7NeKc3Sukjq6ymQxLS7KSamz+8evJDhYF34bL58= Received: (qmail 95597 invoked by alias); 26 Nov 2018 20:49:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 95582 invoked by uid 89); 26 Nov 2018 20:49:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=guides, Hx-languages-length:1588 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; Mon, 26 Nov 2018 20:49:39 +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 CDDE5307DAB6 for ; Mon, 26 Nov 2018 20:49:37 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-117-187.ams2.redhat.com [10.36.117.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C53C5C21A; Mon, 26 Nov 2018 20:49:34 +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 wAQKnWrq018146; Mon, 26 Nov 2018 21:49:32 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id wAQKnVuH018145; Mon, 26 Nov 2018 21:49:31 +0100 Date: Mon, 26 Nov 2018 21:49:31 +0100 From: Jakub Jelinek To: Jason Merrill , Marek Polacek Cc: gcc-patches@gcc.gnu.org Subject: [C++ PATCH] Fix ICE in grokdeclarator (PR c++/88187) Message-ID: <20181126204931.GI12380@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes Hi! Marek has changed grokdeclarator in r263836, so that in this part of code it is either a funcdecl_p (previously the only allowed one), which implies inner_declarator is non-NULL and therefore unqualified_id too, or newly inner_declarator == NULL. In that case, we IMHO shouldn't be testing for the deduction guides errors and let it be rejected as before later. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2018-11-26 Jakub Jelinek PR c++/88187 * decl.c (grokdeclarator): Don't diagnose deduction guide errors if inner_declarator is NULL. * g++.dg/other/pr88187.C: New test. Jakub --- gcc/cp/decl.c.jj 2018-11-17 00:16:41.000000000 +0100 +++ gcc/cp/decl.c 2018-11-26 11:18:30.518620651 +0100 @@ -11276,7 +11276,7 @@ grokdeclarator (const cp_declarator *dec if (!tmpl) if (tree late_auto = type_uses_auto (late_return_type)) tmpl = CLASS_PLACEHOLDER_TEMPLATE (late_auto); - if (tmpl) + if (tmpl && inner_declarator) { if (!dguide_name_p (unqualified_id)) { --- gcc/testsuite/g++.dg/other/pr88187.C.jj 2018-11-26 11:29:46.096459145 +0100 +++ gcc/testsuite/g++.dg/other/pr88187.C 2018-11-26 11:30:58.110269662 +0100 @@ -0,0 +1,7 @@ +// PR c++/88187 +// { dg-do compile } + +template struct A; +void f (A ()); // { dg-error "variable or field 'f' declared void" "" { target c++14_down } } + // { dg-error "missing template arguments before '\\(' token" "" { target c++14_down } .-1 } + // { dg-error "'auto' parameter not permitted in this context" "" { target c++17 } .-2 }