diff options
author | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-15 12:54:18 +0000 |
---|---|---|
committer | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-15 12:54:18 +0000 |
commit | 8f966d798871cdbed21b5d8b3bfe165f0442700f (patch) | |
tree | 81ac9d8e1448195f72838801e225a13df0dd869d /gcc/cp/friend.c | |
parent | ce24a99a9efb0d85add3e2274cb6a18d4637ef67 (diff) | |
download | gcc-8f966d798871cdbed21b5d8b3bfe165f0442700f.tar.gz |
* friend.c (do_friend): Don't take the nested [template] class
into account when deciding whether to warn about the friend
function not referring to a template function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39713 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/friend.c')
-rw-r--r-- | gcc/cp/friend.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index b817c7c3917..170f63bea1d 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -380,6 +380,14 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist, if (! DECL_USE_TEMPLATE (decl)) { + /* We must check whether the decl refers to template + arguments before push_template_decl_real adds a + reference to the containing template class. */ + int warn = (warn_nontemplate_friend + && ! funcdef_flag && ! is_friend_template + && current_template_parms + && uses_template_parms (decl)); + /* We can call pushdecl here, because the TREE_CHAIN of this FUNCTION_DECL is not needed for other purposes. Don't do this for a template instantiation. However, we don't @@ -393,9 +401,7 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist, else decl = push_template_decl_real (decl, /*is_friend=*/1); - if (warn_nontemplate_friend - && ! funcdef_flag && ! is_friend_template - && current_template_parms && uses_template_parms (decl)) + if (warn) { static int explained; cp_warning ("friend declaration `%#D' declares a non-template function", decl); |