diff options
author | Mark Mitchell <mark@codesourcery.com> | 2000-01-11 08:54:28 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2000-01-11 08:54:28 +0000 |
commit | c6f3ffc624dd1b90f7e366f5e85098e38ab8f614 (patch) | |
tree | 327fdb9083c77e47bdb6f070b1dbebe20287db6d /gcc | |
parent | da36fb779780dea445b449356f0fd3b71fb6b30d (diff) | |
download | gcc-c6f3ffc624dd1b90f7e366f5e85098e38ab8f614.zip gcc-c6f3ffc624dd1b90f7e366f5e85098e38ab8f614.tar.gz gcc-c6f3ffc624dd1b90f7e366f5e85098e38ab8f614.tar.bz2 |
friend.c (do_friend): Don't resolve scopes when processing template declarations...
* friend.c (do_friend): Don't resolve scopes when processing
template declarations, even if the qualifying scope doesn't
involve template parameters.
From-SVN: r31321
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/friend.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/friend43.C | 19 |
3 files changed, 27 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 310ca2f..f07e10f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2000-01-11 Mark Mitchell <mark@codesourcery.com> + + * friend.c (do_friend): Don't resolve scopes when processing + template declarations, even if the qualifying scope doesn't + involve template parameters. + 2000-01-10 Mark Mitchell <mitchell@dumbledore.codesourcery.com> * class.c (dfs_modify_vtables_queue_p): Remove. diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index d2325f3..aaeaa8f 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -1,5 +1,5 @@ /* Help friends in C++. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of GNU CC. @@ -402,7 +402,7 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist, /* We can't do lookup in a type that involves template parameters. Instead, we rely on tsubst_friend_function to check the validity of the declaration later. */ - if (uses_template_parms (ctype)) + if (processing_template_decl) add_friend (current_class_type, decl); /* A nested class may declare a member of an enclosing class to be a friend, so we do lookup here even if CTYPE is in diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend43.C b/gcc/testsuite/g++.old-deja/g++.pt/friend43.C new file mode 100644 index 0000000..2597512 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend43.C @@ -0,0 +1,19 @@ +// Build don't link: +// Origin: Matt Austern <austern@isolde.engr.sgi.com> + +class A { +public: + static void f(); +}; + +template <class T> +class B : public A { + friend void A::f(); +}; + +template <class T> +class C : public B<T> +{ +}; + +template class C<char>; |