From d457a29d66693292b2692aa17f038cce88f8962e Mon Sep 17 00:00:00 2001 From: jason Date: Wed, 25 May 2011 01:08:53 +0000 Subject: [PATCH] PR c++/49042 * pt.c (get_mostly_instantiated_function_type): Use push_deferring_access_checks rather than set flag_access_control. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174164 138bc75d-0d04-0410-961f-82ee72b054a4 index e7040c1..b16d229 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -17800,7 +17800,7 @@ get_mostly_instantiated_function_type (tree decl) ; else { - int i, save_access_control; + int i; tree partial_args; /* Replace the innermost level of the TARGS with NULL_TREEs to @@ -17815,8 +17815,7 @@ get_mostly_instantiated_function_type (tree decl) /* Disable access control as this function is used only during name-mangling. */ - save_access_control = flag_access_control; - flag_access_control = 0; + push_deferring_access_checks (dk_no_check); ++processing_template_decl; /* Now, do the (partial) substitution to figure out the @@ -17831,7 +17830,7 @@ get_mostly_instantiated_function_type (tree decl) TREE_VEC_LENGTH (partial_args)--; tparms = tsubst_template_parms (tparms, partial_args, tf_error); - flag_access_control = save_access_control; + pop_deferring_access_checks (); } return fn_type; new file mode 100644 index 0000000..43e5e86 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/access01.C @@ -0,0 +1,15 @@ +// PR c++/49042 +// { dg-options -std=c++0x } + +template +class A +{ + T p; +public: + template auto f() -> decltype(+p) { } +}; + +int main() +{ + A().f(); +} -- 1.7.0.4