C++ PATCH for c++/49107 (excessive instantiation due to noexcept)

Message ID 4DF82C97.5070500@redhat.com
State New
Headers show

Commit Message

Jason Merrill June 15, 2011, 3:52 a.m.
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 <jason@redhat.com>
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);
-  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;
@@ -17373,7 +17370,6 @@  maybe_instantiate_noexcept (tree fn)
 				tf_warning_or_error, fn, /*function_p=*/false,
-  input_location = saved_loc;
   pop_access_scope (fn);
   pop_tinst_level ();
   spec = build_noexcept_spec (noex, tf_warning_or_error);