From patchwork Tue Apr 23 15:25:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 1089469 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-499557-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="S82Hz0U0"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="M363nkdM"; 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 44pS2M2W1fz9sBV for ; Wed, 24 Apr 2019 01:25:44 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=x8r6Yq3A0X1UyMzyx4cqCsijauu1VN9GP66GO9XHNsPE+lkCI4 dJR5FLcgFJ31rkzLJxuSkjG/biJS/07CDvEehK2h3jgsYD8C1rMvOB21IZWlOZEk eUzeV8+y+064UoJMPtvybanR+5GAxk4xmfR4YZNHU2Nc2vPwk916fJWxg= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=LYXnifoKAP0xagm/I2Ds91W0OZg=; b=S82Hz0U0YLX3W8ffErS0 lscPVtQjfoNeWiErKPK6O0KiQH33324noTrqCupe3XQOa5c1cxyFI9KiqyHPHMmJ 6wxSre7quiiB2H+ytoV6BAGPd1mG+nimI7E3LzgfgZGIfUriWcTyUJxm8BBJHoA0 TW87CvCCpHKi3B48RbnjKzc= Received: (qmail 110243 invoked by alias); 23 Apr 2019 15:25:36 -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 110230 invoked by uid 89); 23 Apr 2019 15:25:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=H*r:8.14.4, D*oracle.com, Early X-HELO: aserp2130.oracle.com Received: from aserp2130.oracle.com (HELO aserp2130.oracle.com) (141.146.126.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 23 Apr 2019 15:25:34 +0000 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3NFONlY174136; Tue, 23 Apr 2019 15:25:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : from : subject : message-id : date : mime-version : content-type; s=corp-2018-07-02; bh=12S+G6evQfI/vVQRIMQzIMzHAsnE40qGjGyBq319/3E=; b=M363nkdM4uWCUIQZM9K6R2WoeMjXT23FpEolo+pnCIVITUTTUJPnNALhDotY/bcxbZAt IMhR5C02kuhb8EqNgJiNhKmHI9Ba1cjF0gcEyYowb7TcHDQ6lPnP+h1+7SDqsBv2+gV5 VaRB7H2a/P3/AYdUFH+mJXJmICmZ5yQ/qVE9/Dquig4MKVO600Bh7khF5qYz1RiJfgea EI4+RqkMDTcoFjOzZwafG+JAeWS79eUEXtZbH0rJUGdRqSuR6vHxz1yVLSKZONmq5qS/ pe4k+kJ0vnhj+txF7se5GKGHk6B6LgZEvsTGIWFYzebYSr4zVyCfOUV8X2cQtrSFFBU+ SA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 2ryrxcw5yb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Apr 2019 15:25:32 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3NFOQrT172182; Tue, 23 Apr 2019 15:25:32 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2s0fv327s5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Apr 2019 15:25:32 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x3NFPUxl021129; Tue, 23 Apr 2019 15:25:31 GMT Received: from [192.168.1.4] (/79.42.100.192) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 23 Apr 2019 08:25:30 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 90173 ("[9 Regression] ICE: Segmentation fault (in strip_declarator_types)") Message-ID: <9ff40523-40e5-bca7-b525-7571f45a791b@oracle.com> Date: Tue, 23 Apr 2019 17:25:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 X-IsSubscribed: yes Hi, I tried a few different things to avoid this simple error-recovery regression but, all in all, I think it makes sense to simply bail out early from grokdeclarator upon the first error. Tested x86_64-linux. Thanks, Paolo. /////////////////// /cp 2019-04-23 Paolo Carlini PR c++/90173 * decl.c (grokdeclarator): Early return error_mark_node upon error about template placeholder type non followed by a simple declarator-id. /testsuite 2019-04-23 Paolo Carlini PR c++/90173 * g++.dg/cpp1z/class-deduction66.C: New. Index: cp/decl.c =================================================================== --- cp/decl.c (revision 270500) +++ cp/decl.c (working copy) @@ -10973,6 +10973,7 @@ grokdeclarator (const cp_declarator *declarator, error_at (typespec_loc, "template placeholder type %qT must be followed " "by a simple declarator-id", type); inform (DECL_SOURCE_LOCATION (tmpl), "%qD declared here", tmpl); + return error_mark_node; } staticp = 0; Index: testsuite/g++.dg/cpp1z/class-deduction66.C =================================================================== --- testsuite/g++.dg/cpp1z/class-deduction66.C (nonexistent) +++ testsuite/g++.dg/cpp1z/class-deduction66.C (working copy) @@ -0,0 +1,10 @@ +// PR c++/90173 +// { dg-do run { target c++17 } } + +template struct A { }; + +A(int) -> A; + +namespace decl { + A (*fp)() = 0; // { dg-error "placeholder" } +}