* class.c (finish_struct): Set TREE_PRIVATE and TREE_PROTECTED for
the DECL_RESULTs of a member TEMPLATE_DECL, not just the
TEMPLATE_DECL.
From-SVN: r19376
+Wed Apr 22 13:24:48 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * class.c (finish_struct): Set TREE_PRIVATE and TREE_PROTECTED for
+ the DECL_RESULTs of a member TEMPLATE_DECL, not just the
+ TEMPLATE_DECL.
+
Tue Apr 21 22:00:04 1998 Mark Mitchell <mmitchell@usa.net>
* errfn.c (cp_thing): Use xrealloc, not xmalloc, to copy memory.
TREE_PRIVATE (x) = access == access_private_node;
TREE_PROTECTED (x) = access == access_protected_node;
+ if (TREE_CODE (x) == TEMPLATE_DECL)
+ {
+ TREE_PRIVATE (DECL_RESULT (x)) = TREE_PRIVATE (x);
+ TREE_PROTECTED (DECL_RESULT (x)) = TREE_PROTECTED (x);
+ }
+
/* Check for inconsistent use of this name in the class body.
Enums, types and static vars have already been checked. */
if (TREE_CODE (x) != TYPE_DECL && TREE_CODE (x) != USING_DECL
--- /dev/null
+// Build don't link:
+
+template <class T>
+class S
+{
+protected:
+ template <class U>
+ void f(U); // ERROR - is protected
+
+private:
+ template <class U>
+ void g(U); // ERROR - is private
+};
+
+
+void f()
+{
+ S<double> s;
+ s.f(3); // ERROR - within this context
+ s.g(2.0); // ERROR - within this context
+}