* C++ PATCH for c++/49042 (another acccess/templates issue)
@ 2011-05-25 2:42 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2011-05-25 2:42 UTC (permalink / raw)
To: gcc-patches List
[-- Attachment #1: Type: text/plain, Size: 339 bytes --]
...except we hit this one in mangling rather than deduction. There was
already code here to suppress access control here, but it doesn't work
anymore, since flag_access_control is now only checked at the beginning
of compilation. The fix is to use push_deferring_access_checks instead.
Tested x86_64-pc-linux-gnu, applying to trunk.
[-- Attachment #2: 49042.patch --]
[-- Type: text/x-patch, Size: 1736 bytes --]
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.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 98844c3..bd9aeba 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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;
diff --git a/gcc/testsuite/g++.dg/cpp0x/access01.C b/gcc/testsuite/g++.dg/cpp0x/access01.C
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 T>
+class A
+{
+ T p;
+public:
+ template <class U> auto f() -> decltype(+p) { }
+};
+
+int main()
+{
+ A<int>().f<int>();
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-05-24 23:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-25 2:42 C++ PATCH for c++/49042 (another acccess/templates issue) Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).