This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[rfc] fix c++/19634


Mark, your suggestion in the audit trail seems to work.  Ok?


r~


	* pt.c (get_mostly_instantiated_function_type): Save and restore
	flag_access_control instead of push/pop_access_scope.

Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.974
diff -u -p -d -r1.974 pt.c
--- cp/pt.c	9 Feb 2005 02:53:38 -0000	1.974
+++ cp/pt.c	11 Feb 2005 04:17:11 -0000
@@ -11693,7 +11693,7 @@ get_mostly_instantiated_function_type (t
     ;
   else
     {
-      int i;
+      int i, save_access_control;
       tree partial_args;
 
       /* Replace the innermost level of the TARGS with NULL_TREEs to
@@ -11706,12 +11706,12 @@ get_mostly_instantiated_function_type (t
 			   TMPL_ARGS_DEPTH (targs),
 			   make_tree_vec (DECL_NTPARMS (tmpl)));
 
-      /* Make sure that we can see identifiers, and compute access
-	 correctly.  We can just use the context of DECL for the
-	 partial substitution here.  It depends only on outer template
-	 parameters, regardless of whether the innermost level is
-	 specialized or not.  */
-      push_access_scope (decl);
+      /* Make sure that we can see identifiers by turning off access
+	 checking.  Using the context of the DECL is more expensive
+	 than necessary, assuming that previous checking would have
+	 diagnosed incorrect DECLs.  */
+      save_access_control = flag_access_control;
+      flag_access_control = 0;
 
       ++processing_template_decl;
       /* Now, do the (partial) substitution to figure out the
@@ -11726,7 +11726,7 @@ get_mostly_instantiated_function_type (t
       TREE_VEC_LENGTH (partial_args)--;
       tparms = tsubst_template_parms (tparms, partial_args, tf_error);
 
-      pop_access_scope (decl);
+      flag_access_control = save_access_control;
     }
 
   return fn_type;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]