decl2.c (check_member_template): Set DECL_IGNORED for member class templates, too.
authorMark Mitchell <mmitchell@usa.net>
Tue, 21 Apr 1998 22:03:34 +0000 (22:03 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 21 Apr 1998 22:03:34 +0000 (22:03 +0000)
* decl2.c (check_member_template): Set DECL_IGNORED for member
class templates, too.

From-SVN: r19368

gcc/cp/ChangeLog
gcc/cp/decl2.c

index dc23099536cf4f112a59a39945c2cf3a8d67107e..cffacb0e2f34342598529964bff8d393e9b6c638 100644 (file)
@@ -2,6 +2,9 @@ Tue Apr 21 22:00:04 1998  Mark Mitchell  <mmitchell@usa.net>
 
        * errfn.c (cp_thing): Use xrealloc, not xmalloc, to copy memory.
 
+       * decl2.c (check_member_template): Set DECL_IGNORED for member
+       class templates, too.
+
 Tue Apr 21 18:59:11 1998  Benjamin Kosnik  <bkoz@rhino.cygnus.com>
 
        * decl.c (duplicate_decls): Only check DECL_FRIEND_P if function.
index 8f0c95499f275d1ca647edb1cc099ae574ef0f6e..6b24edc0e0ec3e84ee03b78b449067ca631a876b 100644 (file)
@@ -1343,7 +1343,9 @@ check_member_template (tmpl)
   my_friendly_assert (TREE_CODE (tmpl) == TEMPLATE_DECL, 0);
   decl = DECL_TEMPLATE_RESULT (tmpl);
 
-  if (TREE_CODE (decl) == FUNCTION_DECL) 
+  if (TREE_CODE (decl) == FUNCTION_DECL
+      || (TREE_CODE (decl) == TYPE_DECL
+         && IS_AGGR_TYPE (TREE_TYPE (decl))))
     {
       if (current_function_decl)
        /* 14.5.2.2 [temp.mem]
@@ -1352,7 +1354,7 @@ check_member_template (tmpl)
        cp_error ("declaration of of member template `%#D' in local class",
                  decl);
       
-      if (DECL_VIRTUAL_P (decl)) 
+      if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl))
        {
          /* 14.5.2.3 [temp.mem]
 
@@ -1367,16 +1369,6 @@ check_member_template (tmpl)
         with member templates.  */ 
       DECL_IGNORED_P (tmpl) = 1;
     } 
-  else if (TREE_CODE (decl) == TYPE_DECL
-          && IS_AGGR_TYPE (TREE_TYPE (decl)))
-    {
-      if (current_function_decl)
-       /* 14.5.2.2 [temp.mem]
-
-          A local class shall not have member templates.  */
-       cp_error ("declaration of of member template `%#D' in local class",
-                 decl);
-    }
   else
     cp_error ("template declaration of `%#D'", decl);
 }