From patchwork Tue Aug 30 21:33:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 112387 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 9CA4DB6F87 for ; Wed, 31 Aug 2011 07:33:29 +1000 (EST) Received: (qmail 32398 invoked by alias); 30 Aug 2011 21:33:27 -0000 Received: (qmail 32389 invoked by uid 22791); 30 Aug 2011 21:33:27 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS 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; Tue, 30 Aug 2011 21:33:13 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7ULXDbb020564 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 30 Aug 2011 17:33:13 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p7ULXCmx009717 for ; Tue, 30 Aug 2011 17:33:12 -0400 Received: from [0.0.0.0] ([10.3.113.18]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p7ULXBXp025868 for ; Tue, 30 Aug 2011 17:33:12 -0400 Message-ID: <4E5D5712.6070301@redhat.com> Date: Tue, 30 Aug 2011 17:33:06 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20110817 Thunderbird/6.0 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/50089 (ICE with qualified-id call in lambda) 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 Just needed to correct current_class_type to current_nonlambda_class type here. Tested x86_64-pc-linux-gnu, applying to trunk and 4.6. commit 159563fe81e80fd23ff6252e17c86012a20b169b Author: Jason Merrill Date: Tue Aug 30 15:46:31 2011 -0400 PR c++/50089 * semantics.c (finish_id_expression): Use current_nonlambda_class_type for qualified-ids. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index dd7c013..ce84062 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -3251,7 +3251,7 @@ finish_id_expression (tree id_expression, if (scope) { decl = (adjust_result_of_qualified_name_lookup - (decl, scope, current_class_type)); + (decl, scope, current_nonlambda_class_type())); if (TREE_CODE (decl) == FUNCTION_DECL) mark_used (decl); diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-qualified.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-qualified.C new file mode 100644 index 0000000..ef041c2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-qualified.C @@ -0,0 +1,17 @@ +// PR c++/50089 +// { dg-options -std=c++0x } + +struct TestBase +{ + void foo() {} +}; + +struct Test : TestBase +{ + void foo() + { + [this]{ + /*this->*/TestBase::foo(); // ICE without this-> + }(); + } +};