From patchwork Sat Oct 27 07:02:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Trippelsdorf X-Patchwork-Id: 194602 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 3F4632C00B5 for ; Sat, 27 Oct 2012 18:03:04 +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=1351926185; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=3uTaZTWfQwMnId57ahEtOwJ7xWI=; b=LKv0QiV1LxFZn7w uFI3K6Oz5NwroFcyxmwQfqkUMwQTKhgtLMCqxCthKxbyTNo4EmvAfEgDbOISRN1x 5drkPdyCaD612WSSeTYNiaqK570w43VRVBTnyghNNtfZu3RVHpghSwfLEPP/LFMO ARwqB6hTON0R9AbOFyViIoMPhupA= 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:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=FEXFWS7rnxa4Yd+EZg/4KSc4/qfe05JRXXBd6YBk5ph0FYZF5WkeoAHFUMtB4v TVu4zPOyb8LJestEDyxc2C/TOgXAAv/rSqama/h+34YjlulL5cLoFp9OQdKobWcg ONwiR48SIkIrQBWJMvu8C4lJqkQSE2pC3ePvyyzsMNGpg=; Received: (qmail 10253 invoked by alias); 27 Oct 2012 07:02:57 -0000 Received: (qmail 10237 invoked by uid 22791); 27 Oct 2012 07:02:55 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from ud10.udmedia.de (HELO mail.ud10.udmedia.de) (194.117.254.50) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 27 Oct 2012 07:02:46 +0000 Received: (qmail 22956 invoked from network); 27 Oct 2012 09:02:44 +0200 Received: from unknown (HELO x4) (ud10?360p3@91.64.96.133) by mail.ud10.udmedia.de with ESMTPSA (DHE-RSA-AES256-SHA encrypted, authenticated); 27 Oct 2012 09:02:44 +0200 Date: Sat, 27 Oct 2012 09:02:43 +0200 From: Markus Trippelsdorf To: gcc-patches@gcc.gnu.org Cc: Jason Merrill Subject: C++ (RFC) PATCH fix for PR55076 and PR53921 Message-ID: <20121027070243.GA13009@x4> MIME-Version: 1.0 Content-Disposition: inline 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 The problem here is that we end up with an INDIRECT_REF TREE_CODE with a null TREE_TYPE in lvalue_kind. Is this possible at that point, or does it point to a deeper underlying problem? Bootstraped and tested on x86_64-pc-linux-gnu. 2012-10-27 Markus Trippelsdorf PR c++/50089 PR c++/53921 PR c++/55076 * tree.c (lvalue_kind): Guard against null TREE_TYPE. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 8d555c2..0f1a75d 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -145,7 +145,7 @@ lvalue_kind (const_tree ref) case ARRAY_REF: case PARM_DECL: case RESULT_DECL: - if (TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE) + if (TREE_TYPE (ref) && TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE) return clk_ordinary; break; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template8.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template8.C new file mode 100644 index 0000000..76b6376 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template8.C @@ -0,0 +1,12 @@ +// PR c++/50089 c++/53921 c++/55076 +// { dg-do compile { target c++11 } } +void a (int); +template +struct A +{ + int b; + void c () + { + [=] { a (b); }; //ICE without this->b + }; +};