summaryrefslogtreecommitdiff
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0325-PR-c-48884.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0325-PR-c-48884.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0325-PR-c-48884.patch86
1 files changed, 86 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0325-PR-c-48884.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0325-PR-c-48884.patch
new file mode 100644
index 000000000..3eccc8622
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0325-PR-c-48884.patch
@@ -0,0 +1,86 @@
+From 40c44f13de1ac037a120636d569933155f5e5af7 Mon Sep 17 00:00:00 2001
+From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Wed, 25 May 2011 01:08:46 +0000
+Subject: [PATCH] PR c++/48884
+ * pt.c (fn_type_unification): Disable access control during
+ substitution.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174163 138bc75d-0d04-0410-961f-82ee72b054a4
+
+index c8eb1d5..e7040c1 100644
+--- a/gcc/cp/pt.c
++++ b/gcc/cp/pt.c
+@@ -13743,7 +13743,9 @@ fn_type_unification (tree fn,
+ incomplete = NUM_TMPL_ARGS (explicit_targs) != NUM_TMPL_ARGS (targs);
+
+ processing_template_decl += incomplete;
++ push_deferring_access_checks (dk_no_check);
+ fntype = tsubst (fntype, converted_args, tf_none, NULL_TREE);
++ pop_deferring_access_checks ();
+ processing_template_decl -= incomplete;
+
+ if (fntype == error_mark_node)
+@@ -13830,7 +13832,10 @@ fn_type_unification (tree fn,
+ substitution results in an invalid type, as described above,
+ type deduction fails. */
+ {
+- tree substed = tsubst (TREE_TYPE (fn), targs, tf_none, NULL_TREE);
++ tree substed;
++ push_deferring_access_checks (dk_no_check);
++ substed = tsubst (TREE_TYPE (fn), targs, tf_none, NULL_TREE);
++ pop_deferring_access_checks ();
+ if (substed == error_mark_node)
+ return 1;
+
+new file mode 100644
+index 0000000..8414c43
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/template/access21.C
+@@ -0,0 +1,23 @@
++// PR c++/48884
++
++class X
++{
++ static const int I = 42;
++ friend struct Y;
++};
++
++template <int I> struct A { };
++
++struct Y
++{
++ template <typename T>
++ static A<T::I> f(T t)
++ {
++ return A<T::I>();
++ }
++};
++
++int main()
++{
++ Y::f(X());
++}
+diff --git a/gcc/testsuite/g++.dg/template/access22.C b/gcc/testsuite/g++.dg/template/access22.C
+new file mode 100644
+index 0000000..9ee28a2
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/template/access22.C
+@@ -0,0 +1,15 @@
++template <int I> struct B { };
++
++template <class T>
++B<T::I> f();
++
++class A
++{
++ static const int I = 42;
++ template <class T> friend B<T::I> f();
++};
++
++int main()
++{
++ f<A>();
++}
+--
+1.7.0.4
+