From patchwork Wed Jun 15 03:52:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 100475 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 68F81B6F85 for ; Wed, 15 Jun 2011 13:53:21 +1000 (EST) Received: (qmail 7763 invoked by alias); 15 Jun 2011 03:53:19 -0000 Received: (qmail 7747 invoked by uid 22791); 15 Jun 2011 03:53:17 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_FN, 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; Wed, 15 Jun 2011 03:52:57 +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 p5F3qu7F002716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 14 Jun 2011 23:52:56 -0400 Received: from [127.0.0.1] (ovpn-113-40.phx2.redhat.com [10.3.113.40]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p5F3qu4h026880; Tue, 14 Jun 2011 23:52:56 -0400 Message-ID: <4DF82C97.5070500@redhat.com> Date: Tue, 14 Jun 2011 23:52:55 -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 CC: Paolo Carlini Subject: Re: C++ PATCH for c++/49107 (excessive instantiation due to noexcept) References: <4DEFEA53.9030000@redhat.com> In-Reply-To: <4DEFEA53.9030000@redhat.com> 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 Another testcase attached to 49107 shows that we can't force noexcept instantiation as part of implicitly declaring special member functions; we need to defer their noexcept-specifications as well. While I was working on this I noticed that it's not necessary to save and restore input_location when doing push/pop_tinst_level, as pop_tinst_level will restore the previous input_location, so in a separate patch I remove the unnecessary code I added recently. Tested x86_64-pc-linux-gnu, applying to trunk. commit b0a459bd4e40cddea002782afac4f25441b027ab Author: Jason Merrill Date: Tue Jun 14 15:02:32 2011 -0400 * pt.c (deduction_tsubst_fntype): Don't save input_location. (maybe_instantiate_noexcept): Likewise. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 814a08f..5f53ce8 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13635,7 +13635,6 @@ deduction_tsubst_fntype (tree fn, tree targs) { static bool excessive_deduction_depth; static int deduction_depth; - location_t save_loc = input_location; struct pending_template *old_last_pend = last_pending_template; tree fntype = TREE_TYPE (fn); @@ -13659,7 +13658,6 @@ deduction_tsubst_fntype (tree fn, tree targs) r = tsubst (fntype, targs, tf_none, NULL_TREE); pop_deduction_access_scope (fn); --deduction_depth; - input_location = save_loc; if (excessive_deduction_depth) { @@ -17359,7 +17357,6 @@ maybe_instantiate_noexcept (tree fn) tree fntype = TREE_TYPE (fn); tree spec = TYPE_RAISES_EXCEPTIONS (fntype); tree noex = NULL_TREE; - location_t saved_loc = input_location; tree clone; if (!DEFERRED_NOEXCEPT_SPEC_P (spec)) @@ -17373,7 +17370,6 @@ maybe_instantiate_noexcept (tree fn) DEFERRED_NOEXCEPT_ARGS (noex), tf_warning_or_error, fn, /*function_p=*/false, /*integral_constant_expression_p=*/true); - input_location = saved_loc; pop_access_scope (fn); pop_tinst_level (); spec = build_noexcept_spec (noex, tf_warning_or_error);