From patchwork Thu Sep 27 11:08:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 187325 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 BF94C2C0097 for ; Thu, 27 Sep 2012 21:08:48 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1349348930; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Message-ID:Date:From:User-Agent:MIME-Version: To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=Sf77wsEWqmz82ow2BnqaeVfL9Ws=; b=BR1z0SXWSW4cp8M pOaqYgTXszL78O1NmI9bG1pLR+rS6w8W2eAuSY+p3SY3y/IszgMCIRdB7670g3zB wqoHf81h8PTQORABlz9fPWbUF0Soce4xAuUvTQ3lB5fRGtm1BNlMs9GtX3/+j9j1 mboLVTwR/J8xb9t1OR2ZWp8QZOSE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=FXMRYVxVf5bClTTnrAt4y04pYz90gbgqnqEYLLEBXUbSyWfcg527gKFXFPFN7d /B+rBoH1EIoPbIq+BaWODbvRfDodP3amjM2aCUpwtHTqy+ihnGxXE16BxAqrtffD dVDnUAq5XnywVommzDcE8teI+0uI3CRwID24S3BdWeAzA=; Received: (qmail 25583 invoked by alias); 27 Sep 2012 11:08:44 -0000 Received: (qmail 25575 invoked by uid 22791); 27 Sep 2012 11:08:43 -0000 X-SWARE-Spam-Status: No, hits=-7.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from acsinet15.oracle.com (HELO acsinet15.oracle.com) (141.146.126.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Sep 2012 11:08:39 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q8RB8aDl007287 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 27 Sep 2012 11:08:37 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q8RB8a0M025247 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 27 Sep 2012 11:08:36 GMT Received: from abhmt106.oracle.com (abhmt106.oracle.com [141.146.116.58]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q8RB8aS0011829; Thu, 27 Sep 2012 06:08:36 -0500 Received: from [192.168.1.4] (/79.33.221.141) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 27 Sep 2012 04:08:35 -0700 Message-ID: <506433B1.1010206@oracle.com> Date: Thu, 27 Sep 2012 13:08:33 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120825 Thunderbird/15.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch / RFC] PR 51422 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 Hi, almost forgot that a few weeks ago I spent some time on this PR... The issue is simple: in these repeated error conditions we ICE on the gcc_assert in is_normal_capture_proxy: decl is a VAR_DECL with an error_mark_node as TREE_TYPE. Then checking error_operand_p (decl) in is_capture_proxy solves the problem but now the question is: do we have reasons to believe that such VAR_DECLs should never ever reach is_normal_capture_proxy? Otherwise robustifying a predicate like this seems a good idea to me. Patch passes testing on x86_64-linux of course. Thanks! Paolo. /////////////////////////// Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 190666) +++ cp/semantics.c (working copy) @@ -8929,6 +8929,9 @@ capture_decltype (tree decl) bool is_capture_proxy (tree decl) { + if (error_operand_p (decl)) + return false; + return (TREE_CODE (decl) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (decl) && !DECL_ANON_UNION_VAR_P (decl) Index: testsuite/g++.dg/cpp0x/lambda/lambda-ice8.C =================================================================== --- testsuite/g++.dg/cpp0x/lambda/lambda-ice8.C (revision 0) +++ testsuite/g++.dg/cpp0x/lambda/lambda-ice8.C (revision 0) @@ -0,0 +1,10 @@ +// PR c++/51422 +// { dg-do compile { target c++11 } } + +template struct A {}; + +void foo() +{ + [i] { A(); }; // { dg-error "not declared|invalid" } + [i] { A(); }; // { dg-error "invalid" } +}