summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0326-PR-c-49042.patch
blob: 3887365cc9e50cfdca2d9b444fbeeeea0288575c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From d457a29d66693292b2692aa17f038cce88f8962e Mon Sep 17 00:00:00 2001
From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
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 T>
+class A
+{
+  T p;
+public:
+  template <class U> auto f() -> decltype(+p) { }
+};
+
+int main()
+{
+  A<int>().f<int>();
+}
-- 
1.7.0.4