diff options
author | Mark Mitchell <mmitchell@usa.net> | 1998-04-22 13:23:32 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1998-04-22 13:23:32 +0000 |
commit | 43ee49e8f39d5d3d678f742a2d2e89f073632835 (patch) | |
tree | a707e26881caf1023846c1db55586d07793a5745 | |
parent | 27eef9cececccd37254c9106b02fd965369650eb (diff) | |
download | gcc-43ee49e8f39d5d3d678f742a2d2e89f073632835.zip gcc-43ee49e8f39d5d3d678f742a2d2e89f073632835.tar.gz gcc-43ee49e8f39d5d3d678f742a2d2e89f073632835.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/class.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/memtemp74.C | 21 |
3 files changed, 33 insertions, 0 deletions
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 <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. 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 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 +} |