From patchwork Mon May 23 14:59:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 96967 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 474BCB6FAA for ; Tue, 24 May 2011 00:59:27 +1000 (EST) Received: (qmail 17000 invoked by alias); 23 May 2011 14:59:26 -0000 Received: (qmail 16991 invoked by uid 22791); 23 May 2011 14:59:25 -0000 X-SWARE-Spam-Status: No, hits=-6.3 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; Mon, 23 May 2011 14:59:11 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4NExBlw002272 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 23 May 2011 10:59:11 -0400 Received: from [127.0.0.1] ([10.3.113.3]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p4NExARP007708 for ; Mon, 23 May 2011 10:59:11 -0400 Message-ID: <4DDA763E.2040603@redhat.com> Date: Mon, 23 May 2011 10:59:10 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/47336 (ICE re-entering diagnostic routines) 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 In this case, we ran into an access control error trying to print the meaning of a decltype while dumping instantiation context. The simplest answer is to just disable access control during that process rather than try to push into the right context. Tested x86_64-pc-linux-gnu, applying to trunk. commit 8b9688d5cdf39fb306257ea0d02a7e4239179913 Author: Jason Merrill Date: Sun May 22 15:54:43 2011 -0400 PR c++/47336 * error.c (dump_template_bindings): Suppress access control. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index e580fd9..a6648cc 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -313,7 +313,9 @@ dump_template_bindings (tree parms, tree args, VEC(tree,gc)* typenames) pp_cxx_whitespace (cxx_pp); pp_equal (cxx_pp); pp_cxx_whitespace (cxx_pp); + push_deferring_access_checks (dk_no_check); t = tsubst (t, args, tf_none, NULL_TREE); + pop_deferring_access_checks (); /* Strip typedefs. We can't just use TFF_CHASE_TYPEDEF because pp_simple_type_specifier doesn't know about it. */ t = strip_typedefs (t); diff --git a/gcc/testsuite/g++.dg/cpp0x/error3.C b/gcc/testsuite/g++.dg/cpp0x/error3.C new file mode 100644 index 0000000..e7da961 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/error3.C @@ -0,0 +1,24 @@ +// PR c++/47336 +// { dg-options -std=c++0x } + +template +void g(T t) +{ + t+1; // { dg-error "no match" } +} + +template +class C +{ + struct D {} d; +public: + decltype(g(d)) h() + { + return g(d); + } +}; + +int main() +{ + C().h(); +}