From 43ee49e8f39d5d3d678f742a2d2e89f073632835 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Wed, 22 Apr 1998 13:23:32 +0000 Subject: class.c (finish_struct): Set TREE_PRIVATE and TREE_PROTECTED for the DECL_RESULTs of a member... * 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 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/class.c | 6 ++++++ gcc/testsuite/g++.old-deja/g++.pt/memtemp74.C | 21 +++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/memtemp74.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9e69044..20725d8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +Wed Apr 22 13:24:48 1998 Mark Mitchell + + * 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 * errfn.c (cp_thing): Use xrealloc, not xmalloc, to copy memory. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 5c4be24..fc1c675 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -4318,6 +4318,12 @@ finish_struct (t, list_of_fieldlists, attributes, warn_anon) 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 diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp74.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp74.C new file mode 100644 index 0000000..e99103f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp74.C @@ -0,0 +1,21 @@ +// Build don't link: + +template +class S +{ +protected: + template + void f(U); // ERROR - is protected + +private: + template + void g(U); // ERROR - is private +}; + + +void f() +{ + S s; + s.f(3); // ERROR - within this context + s.g(2.0); // ERROR - within this context +} -- cgit v1.1