PR c++/3663
* pt.c (lookup_template_class): Copy TREE_PRIVATE and
TREE_PROTECTED to created decl nodes.
* g++.dg/template/access7.C: New test.
From-SVN: r60307
+2002-12-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/3663
+ * pt.c (lookup_template_class): Copy TREE_PRIVATE and
+ TREE_PROTECTED to created decl nodes.
+
2002-12-18 Mark Mitchell <mark@codesourcery.com>
* class.c (build_base_field): Do not set DECL_PACKED on the
else
type_decl = TYPE_NAME (t);
+ TREE_PRIVATE (type_decl)
+ = TREE_PRIVATE (TYPE_STUB_DECL (template_type));
+ TREE_PROTECTED (type_decl)
+ = TREE_PROTECTED (TYPE_STUB_DECL (template_type));
+
/* Set up the template information. We have to figure out which
template is the immediate parent if this is a full
instantiation. */
+2002-11-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/3663
+ * g++.dg/template/access7.C: New test.
+
2002-12-18 Nick Clifton <nickc@redhat.com>
* lib/g++.exp (g++_include_flags): Only invoke testsuite_flags if
--- /dev/null
+// { dg-do compile }
+
+// PR c++/3663
+// Enforce access of nested type.
+
+template <typename A>
+class S {
+ class T {}; // { dg-error "private" }
+};
+
+template <typename A>
+typename A::T* f (A) { // { dg-error "this context" }
+ return 0;
+}
+
+void g () {
+ f (S<int> ()); // { dg-error "context|instantiated" }
+}