From patchwork Sun Oct 7 10:47:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 189799 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 0048B2C01E6 for ; Sun, 7 Oct 2012 21:47:19 +1100 (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=1350211640; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Message-ID:Date:From:User-Agent:MIME-Version: To:CC:Subject:References:In-Reply-To:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=tZUBuiS13gFA5lFaK4BvNC9Tiqo=; b=O3TkFyvn1w2Ygv5VOTdC1i98ayhsgEao4O0YVi6OIypzaa3y1Z0k06KuhjVgaS vkXVqa9HbQohUe3S6WhWDHVynz9I+0qkFclR8txJyKWy2P+oVMjHXbvFKjSN8sO/ y2cRz9y10eVUSfBpKNnq7Mj/j5Hty02OWESs42FKfK7do= 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:References:In-Reply-To:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=HWvKKn3j3rMoRmmEj/TMcJi5bwMw1b6Fc3QF6ciHleLLC9krhNZCm/dWmA2xyT tgetEGlfw3EjWbuKAxlHMc/AENh4rHJk0RVY57+RFqQt67MP88Wkdns6mixPAfso g5JLpYrz9DhNXt9gqi+kz0FEZd3qmDOSrZy9OaKgEATLs=; Received: (qmail 17499 invoked by alias); 7 Oct 2012 10:47:16 -0000 Received: (qmail 17489 invoked by uid 22791); 7 Oct 2012 10:47:14 -0000 X-SWARE-Spam-Status: No, hits=-8.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, 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; Sun, 07 Oct 2012 10:47:09 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q97Al7RV028535 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 7 Oct 2012 10:47:08 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q97Al76b017760 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 7 Oct 2012 10:47:07 GMT Received: from abhmt111.oracle.com (abhmt111.oracle.com [141.146.116.63]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q97Al6tg032353; Sun, 7 Oct 2012 05:47:06 -0500 Received: from [192.168.1.4] (/79.51.26.101) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 07 Oct 2012 03:47:06 -0700 Message-ID: <50715DA8.1040902@oracle.com> Date: Sun, 07 Oct 2012 12:47:04 +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: Jason Merrill CC: "gcc-patches@gcc.gnu.org" Subject: Re: [C++ Patch / RFC] PR 51422 References: <506433B1.1010206@oracle.com> <5070378E.4020308@redhat.com> In-Reply-To: <5070378E.4020308@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 Hi, On 10/06/2012 03:52 PM, Jason Merrill wrote: > On 09/27/2012 07:08 AM, Paolo Carlini wrote: >> 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? > > That depends on our error recovery strategy for an invalid capture. > It seems that we currently build a VAR_DECL that has an > error_mark_node DECL_VALUE_EXPR; if we're going to do that, we need to > deal with it. I guess we should return true in that case, if it > doesn't cause more problems later on. Ah good, thanks for the suggestion. Then the below passes testing on x86_64-linux. Ok for mainline? Thanks again, Paolo. //////////////////////// /cp 2012-10-07 Paolo Carlini PR c++/51422 * semantics.c (is_normal_capture_proxy): Return true for error_mark_node as DECL_VALUE_EXPR. /testsuite 2012-10-07 Paolo Carlini PR c++/51422 * g++.dg/cpp0x/lambda/lambda-ice8.C: New. Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 192179) +++ cp/semantics.c (working copy) @@ -3,8 +3,7 @@ building RTL. These routines are used both during actual parsing and during the instantiation of template functions. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. + Copyright (C) 1998-2012 Free Software Foundation, Inc. Written by Mark Mitchell (mmitchell@usa.net) based on code found formerly in parse.y and pt.c. @@ -9005,14 +9004,15 @@ is_capture_proxy (tree decl) bool is_normal_capture_proxy (tree decl) { - tree val; - if (!is_capture_proxy (decl)) /* It's not a capture proxy. */ return false; /* It is a capture proxy, is it a normal capture? */ - val = DECL_VALUE_EXPR (decl); + tree val = DECL_VALUE_EXPR (decl); + if (val == error_mark_node) + return true; + gcc_assert (TREE_CODE (val) == COMPONENT_REF); val = TREE_OPERAND (val, 1); return DECL_NORMAL_CAPTURE_P (val); 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 (working copy) @@ -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" } +}