From patchwork Thu Feb 16 19:52:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 141668 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 9B518B6EE6 for ; Fri, 17 Feb 2012 06:53:25 +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=1330026806; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=gHpw9D1 HSC6hoYDykhec6OtgOOQ=; b=iV/bPmc58IVFAGWrTXSULKIB8gEtZ27mxwVQH1U q8txYHMJ6w5dDPMb8wH0Q+WLZg+2ta+gr+0ZZTXfqjcJUOVhli8X/+SPhMzbntGb BiLrVuLJ+7DvWRc/gOQRbH1Sv35hbjiM//5pUoVHGsmqvys7fCAKWHJyQL5Jycd3 ILl0= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=xE7KYjGiW2x8FAGTOQGlpQhPMii2N2oEMgkm4piG64VxmhTuBjA9mFiEctoGi6 La3n6Vo5EfuiBefPc8ARM+PtyOUjqOXOnhYBrMyhScmNep3q9073iPDWDQ5La4lC coUaKJq/MocsIUDuU2HqULY8Og+PCQBu3mmV04ESI0rjk=; Received: (qmail 2708 invoked by alias); 16 Feb 2012 19:53:11 -0000 Received: (qmail 2698 invoked by uid 22791); 16 Feb 2012 19:53:09 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Feb 2012 19:52:50 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1GJqnrI005933 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 16 Feb 2012 14:52:49 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q1GJqnn2010125 for ; Thu, 16 Feb 2012 14:52:49 -0500 Received: from [0.0.0.0] (ovpn-113-150.phx2.redhat.com [10.3.113.150]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id q1GJqm1v005825 for ; Thu, 16 Feb 2012 14:52:48 -0500 Message-ID: <4F3D5E8F.5020409@redhat.com> Date: Thu, 16 Feb 2012 11:52:47 -0800 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20120209 Thunderbird/10.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/51415 (vec_init_expr not handled by dump_expr) 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 Lambda closure object initialization uses VEC_INIT_EXPR to express array copy, which confused dump_expr. But there's no reason to print out the details of that initialization at all; we should just say "closure object" and be done with it. Of course, this is another instance of problems with printing the internal expression representation rather than the source form... Tested x86_64-pc-linux-gnu, applied to trunk commit 25a7d8c9be6a926081d2a0460984366fa49bbe22 Author: Jason Merrill Date: Thu Feb 16 10:28:57 2012 -0800 PR c++/51415 * error.c (dump_expr): Handle lambda closures specifically. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 09c6cae..4ec263b 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -2189,6 +2189,8 @@ dump_expr (tree t, int flags) } } } + if (TREE_TYPE (t) && LAMBDA_TYPE_P (TREE_TYPE (t))) + pp_string (cxx_pp, ""); if (TREE_TYPE (t) && EMPTY_CONSTRUCTOR_P (t)) { dump_type (TREE_TYPE (t), 0); diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-err1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-err1.C new file mode 100644 index 0000000..ebf0cbd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-err1.C @@ -0,0 +1,8 @@ +// PR c++/51415 +// { dg-do compile { target c++11 } } + +void foo() +{ + int x[1]; + [x]{} = 0; // { dg-error "lambda closure" } +}