From 783c26ae6798141f9822f52b45b24abf685c0afc Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 7 Jun 2011 17:53:53 -0400 Subject: [PATCH] pt.c (deduction_tsubst_fntype): Use push_deduction_access_scope. * pt.c (deduction_tsubst_fntype): Use push_deduction_access_scope. (fn_type_unification): Don't call push_deduction_access_scope here. From-SVN: r174771 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 18 +++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ba3fd1a3f0c..641bf73bd05 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-06-07 Jason Merrill + + * pt.c (deduction_tsubst_fntype): Use push_deduction_access_scope. + (fn_type_unification): Don't call push_deduction_access_scope here. + 2011-06-06 Jason Merrill PR c++/48780 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c9557770ccc..ce43d8a669e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -111,6 +111,8 @@ static GTY(()) VEC(tree,gc) *canonical_template_parms; static void push_access_scope (tree); static void pop_access_scope (tree); +static void push_deduction_access_scope (tree); +static void pop_deduction_access_scope (tree); static bool resolve_overloaded_unification (tree, tree, tree, tree, unification_kind_t, int); static int try_one_overload (tree, tree, tree, tree, tree, @@ -13633,7 +13635,12 @@ deduction_tsubst_fntype (tree fn, tree targs) /* We don't need to worry about this in C++98. */ if (cxx_dialect < cxx0x) - return tsubst (fntype, targs, tf_none, NULL_TREE); + { + push_deduction_access_scope (fn); + r = tsubst (fntype, targs, tf_none, NULL_TREE); + pop_deduction_access_scope (fn); + return r; + } /* If we're seeing a lot of recursion, switch over to a hash table. The constant 40 is fairly arbitrary. */ @@ -13698,7 +13705,9 @@ deduction_tsubst_fntype (tree fn, tree targs) VEC_safe_push (spec_entry, gc, current_deduction_vec, &elt); } + push_deduction_access_scope (fn); r = tsubst (fntype, targs, tf_none, NULL_TREE); + pop_deduction_access_scope (fn); /* After doing the substitution, make sure we didn't hit it again. Note that we might have switched to a hash table during tsubst. */ @@ -14017,9 +14026,7 @@ fn_type_unification (tree fn, incomplete = NUM_TMPL_ARGS (explicit_targs) != NUM_TMPL_ARGS (targs); processing_template_decl += incomplete; - push_deduction_access_scope (fn); fntype = deduction_tsubst_fntype (fn, converted_args); - pop_deduction_access_scope (fn); processing_template_decl -= incomplete; if (fntype == error_mark_node) @@ -14090,10 +14097,7 @@ fn_type_unification (tree fn, substitution results in an invalid type, as described above, type deduction fails. */ { - tree substed; - push_deduction_access_scope (fn); - substed = deduction_tsubst_fntype (fn, targs); - pop_deduction_access_scope (fn); + tree substed = deduction_tsubst_fntype (fn, targs); if (substed == error_mark_node) return 1; -- 2.30.2