commit b59f44587a32d3ff68d0dedac8f82df1f299cfd0
Author: Jason Merrill <jason@redhat.com>
Date: Tue May 24 16:48:02 2011 -0400
PR c++/49042
* pt.c (get_mostly_instantiated_function_type): Use
push_deferring_access_checks rather than set flag_access_control.
@@ -18045,7 +18045,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
@@ -18060,8 +18060,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
@@ -18076,7 +18075,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
@@ -0,0 +1,15 @@
+// PR c++/49042
+// { dg-options -std=c++0x }
+
+template <class T>
+class A
+{
+ T p;
+public:
+ template <class U> auto f() -> decltype(+p) { }
+};
+
+int main()
+{
+ A<int>().f<int>();
+}