]> gcc.gnu.org Git - gcc.git/commitdiff
friend.c (do_friend): Don't take the nested [template] class into account when...
authorAlexandre Oliva <aoliva@redhat.com>
Thu, 15 Feb 2001 12:54:18 +0000 (12:54 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Thu, 15 Feb 2001 12:54:18 +0000 (12:54 +0000)
* 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

gcc/cp/ChangeLog
gcc/cp/friend.c

index 7f14cfbc92d33db144215edfc8de14cd828c7516..e8119eac4a7797220a199a59a827756a9200fd3d 100644 (file)
@@ -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.
index b817c7c391793b5baab3c36eabc35eee802c591d..170f63bea1de8fc9a2ca0fdfb1960a3dc5a0ce40 100644 (file)
@@ -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);
This page took 0.077286 seconds and 5 git commands to generate.