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
This commit is contained in:
parent
da36fb7797
commit
c6f3ffc624
3 changed files with 27 additions and 2 deletions
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
19
gcc/testsuite/g++.old-deja/g++.pt/friend43.C
Normal file
19
gcc/testsuite/g++.old-deja/g++.pt/friend43.C
Normal file
|
@ -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>;
|
Loading…
Add table
Reference in a new issue