summaryrefslogtreecommitdiffstats
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 0000000000..3eccc8622f
--- /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 @@
1From 40c44f13de1ac037a120636d569933155f5e5af7 Mon Sep 17 00:00:00 2001
2From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Wed, 25 May 2011 01:08:46 +0000
4Subject: [PATCH] PR c++/48884
5 * pt.c (fn_type_unification): Disable access control during
6 substitution.
7
8git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174163 138bc75d-0d04-0410-961f-82ee72b054a4
9
10index c8eb1d5..e7040c1 100644
11--- a/gcc/cp/pt.c
12+++ b/gcc/cp/pt.c
13@@ -13743,7 +13743,9 @@ fn_type_unification (tree fn,
14 incomplete = NUM_TMPL_ARGS (explicit_targs) != NUM_TMPL_ARGS (targs);
15
16 processing_template_decl += incomplete;
17+ push_deferring_access_checks (dk_no_check);
18 fntype = tsubst (fntype, converted_args, tf_none, NULL_TREE);
19+ pop_deferring_access_checks ();
20 processing_template_decl -= incomplete;
21
22 if (fntype == error_mark_node)
23@@ -13830,7 +13832,10 @@ fn_type_unification (tree fn,
24 substitution results in an invalid type, as described above,
25 type deduction fails. */
26 {
27- tree substed = tsubst (TREE_TYPE (fn), targs, tf_none, NULL_TREE);
28+ tree substed;
29+ push_deferring_access_checks (dk_no_check);
30+ substed = tsubst (TREE_TYPE (fn), targs, tf_none, NULL_TREE);
31+ pop_deferring_access_checks ();
32 if (substed == error_mark_node)
33 return 1;
34
35new file mode 100644
36index 0000000..8414c43
37--- /dev/null
38+++ b/gcc/testsuite/g++.dg/template/access21.C
39@@ -0,0 +1,23 @@
40+// PR c++/48884
41+
42+class X
43+{
44+ static const int I = 42;
45+ friend struct Y;
46+};
47+
48+template <int I> struct A { };
49+
50+struct Y
51+{
52+ template <typename T>
53+ static A<T::I> f(T t)
54+ {
55+ return A<T::I>();
56+ }
57+};
58+
59+int main()
60+{
61+ Y::f(X());
62+}
63diff --git a/gcc/testsuite/g++.dg/template/access22.C b/gcc/testsuite/g++.dg/template/access22.C
64new file mode 100644
65index 0000000..9ee28a2
66--- /dev/null
67+++ b/gcc/testsuite/g++.dg/template/access22.C
68@@ -0,0 +1,15 @@
69+template <int I> struct B { };
70+
71+template <class T>
72+B<T::I> f();
73+
74+class A
75+{
76+ static const int I = 42;
77+ template <class T> friend B<T::I> f();
78+};
79+
80+int main()
81+{
82+ f<A>();
83+}
84--
851.7.0.4
86