From patchwork Wed Sep 7 16:50:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 113796 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id B87C1B6F81 for ; Thu, 8 Sep 2011 02:51:22 +1000 (EST) Received: (qmail 24201 invoked by alias); 7 Sep 2011 16:51:19 -0000 Received: (qmail 24192 invoked by uid 22791); 7 Sep 2011 16:51:17 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet15.oracle.com (HELO rcsinet15.oracle.com) (148.87.113.117) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Sep 2011 16:50:56 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p87Gorks009278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 7 Sep 2011 16:50:55 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p87GoqNd016670 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 7 Sep 2011 16:50:53 GMT Received: from abhmt118.oracle.com (abhmt118.oracle.com [141.146.116.70]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p87GolIX015242; Wed, 7 Sep 2011 11:50:47 -0500 Received: from [192.168.1.4] (/79.51.11.66) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 07 Sep 2011 09:50:47 -0700 Message-ID: <4E67A0EE.3060001@oracle.com> Date: Wed, 07 Sep 2011 18:50:54 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110812 Thunderbird/6.0 MIME-Version: 1.0 To: Jason Merrill CC: "gcc-patches@gcc.gnu.org" Subject: Re: [C++ Patch] PR 50309 References: <4E674980.8080006@oracle.com> <4E679ECE.6090205@redhat.com> In-Reply-To: <4E679ECE.6090205@redhat.com> X-IsSubscribed: yes 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 On 09/07/2011 06:41 PM, Jason Merrill wrote: > On 09/07/2011 06:37 AM, Paolo Carlini wrote: >> I have the below simple patch to avoid the ICE after error. Tested >> x86_64-linux. Is it Ok? In case, if it applies as-is, 4_6-branch too? > I think this is a recoverable error; if the exception-specification is > ill-formed, let's pretend there wasn't one rather than discard the > whole declaration. Agreed. I'm finishing testing the below. Ok if it passes? Paolo. /////////////////// Index: testsuite/g++.dg/cpp0x/noexcept14.C =================================================================== --- testsuite/g++.dg/cpp0x/noexcept14.C (revision 0) +++ testsuite/g++.dg/cpp0x/noexcept14.C (revision 0) @@ -0,0 +1,4 @@ +// PR c++/50309 +// { dg-options -std=c++0x } + +void foo () noexcept () { } // { dg-error "expected" } Index: cp/decl.c =================================================================== --- cp/decl.c (revision 178631) +++ cp/decl.c (working copy) @@ -9049,6 +9049,10 @@ grokdeclarator (const cp_declarator *declarator, virt_specifiers = declarator->u.function.virt_specifiers; /* Pick up the exception specifications. */ raises = declarator->u.function.exception_specification; + /* If the exception-specification is ill-formed, let's pretend + there wasn't one. */ + if (raises == error_mark_node) + raises = NULL_TREE; /* Say it's a definition only for the CALL_EXPR closest to the identifier. */