aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2001-02-15 12:54:18 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2001-02-15 12:54:18 +0000
commit8826b15be351ee4049126d604ae88a354bc9fc03 (patch)
tree81ac9d8e1448195f72838801e225a13df0dd869d /gcc
parentff78d08278c15e2d8266575ecba3fcd04c50edc1 (diff)
downloadgcc-8826b15be351ee4049126d604ae88a354bc9fc03.zip
gcc-8826b15be351ee4049126d604ae88a354bc9fc03.tar.gz
gcc-8826b15be351ee4049126d604ae88a354bc9fc03.tar.bz2
friend.c (do_friend): Don't take the nested [template] class into account when...
* 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. From-SVN: r39713
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/friend.c12
2 files changed, 15 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7f14cfb..e8119ea 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2001-02-15 Alexandre Oliva <aoliva@redhat.com>
+
+ * 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.
+
2001-02-14 Jakub Jelinek <jakub@redhat.com>
* typeck.c (build_unary_op): Clarify error message.
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index b817c7c..170f63b 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);