]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport:
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Wed, 7 Dec 2005 19:32:17 +0000 (19:32 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Wed, 7 Dec 2005 19:32:17 +0000 (19:32 +0000)
2005-10-20  Mark Mitchell  <mark@codesourcery.com>

PR c++/22618
* search.c (accessible_p): Check access in the outermost set of
template parameters.

* g++.dg/parse/access8.C: New test.

From-SVN: r108173

gcc/cp/ChangeLog
gcc/cp/search.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/access8.C [new file with mode: 0644]

index 6d139be49ba4874fdda891ee93c64a1c75772b3f..4f884dba1582b363d9fd6278811a6e3d054ffd2c 100644 (file)
@@ -1,3 +1,12 @@
+2005-12-07  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       Backport:
+       2005-10-20  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/22618
+       * search.c (accessible_p): Check access in the outermost set of
+       template parameters.
+
 2005-12-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        Backport:
index 0dfdb922978904ba82c19fd4e479c5865c7185a5..c227175b0ca1f2f6d23bc47505f7c851b67e6784 100644 (file)
@@ -946,8 +946,12 @@ accessible_p (tree type, tree decl)
   /* In a template declaration, we cannot be sure whether the
      particular specialization that is instantiated will be a friend
      or not.  Therefore, all access checks are deferred until
-     instantiation.  */
-  if (processing_template_decl)
+     instantiation.  However, PROCESSING_TEMPLATE_DECL is set in the
+     parameter list for a template (because we may see dependent types
+     in default arguments for template parameters), and access
+     checking should be performed in the outermost parameter list.  */ 
+  if (processing_template_decl 
+      && (!processing_template_parmlist || processing_template_decl > 1))
     return 1;
 
   if (!TYPE_P (type))
index d8d2b4857d0affe8a8b6196e39cbecbb058b71da..51c272d4c8292b2dc9a5c0f010c3a1ed55963261 100644 (file)
@@ -1,3 +1,11 @@
+2005-12-07  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       Backport:
+       2005-10-20  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/22618
+       * g++.dg/parse/access8.C: New test.
+
 2005-12-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        Backport:
diff --git a/gcc/testsuite/g++.dg/parse/access8.C b/gcc/testsuite/g++.dg/parse/access8.C
new file mode 100644 (file)
index 0000000..badea1c
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/22618
+
+class foo
+{
+  typedef int memfun;  // { dg-error "private" }
+};
+
+template<foo::memfun> // { dg-error "context" } 
+struct fm_obj { };
+
+template <typename T = foo::memfun> // { dg-error "context" }
+struct S {};