decl.c (grokfndecl): Handle definition of specialization in friend declaration.
authorJason Merrill <jason@yorick.cygnus.com>
Wed, 20 May 1998 23:53:04 +0000 (23:53 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 20 May 1998 23:53:04 +0000 (19:53 -0400)
* decl.c (grokfndecl): Handle definition of specialization in
friend declaration.
* error.c (dump_decl): Fix LOOKUP_EXPR handling.

From-SVN: r19919

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/error.c

index 4d991fdaab705aea6222cbcaa080f75b54f6e0d1..6353d8d31d2bedd672323370db57b994fa7be0a4 100644 (file)
@@ -1,3 +1,10 @@
+1998-05-20  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl.c (grokfndecl): Handle definition of specialization in
+       friend declaration.
+
+       * error.c (dump_decl): Fix LOOKUP_EXPR handling.
+
 1998-05-20  Mark Mitchell  <mmitchell@usa.net>
 
        * class.c (delete_duplicate_fields_1): Use DECL_DECLARES_TYPE_P
index 94de1dabcea3f7392585648753c9df410c575644..a4f9e005f55036d382f0228236f9f7dfe4828cb2 100644 (file)
@@ -7625,16 +7625,23 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
        break;
       }
 
-  if (friendp && 
-      TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR)
-    {
-      /* A friend declaration of the form friend void f<>().  Record
-        the information in the TEMPLATE_ID_EXPR.  */
-      SET_DECL_IMPLICIT_INSTANTIATION (decl);
-      DECL_TEMPLATE_INFO (decl) 
-       = perm_tree_cons (TREE_OPERAND (orig_declarator, 0),
-                         TREE_OPERAND (orig_declarator, 1),
-                         NULL_TREE);
+  if (friendp
+      && TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR)
+    {
+      if (funcdef_flag)
+       cp_error
+         ("defining explicit specialization `%D' in friend declaration",
+          orig_declarator);
+      else
+       {
+         /* A friend declaration of the form friend void f<>().  Record
+            the information in the TEMPLATE_ID_EXPR.  */
+         SET_DECL_IMPLICIT_INSTANTIATION (decl);
+         DECL_TEMPLATE_INFO (decl)
+           = perm_tree_cons (TREE_OPERAND (orig_declarator, 0),
+                             TREE_OPERAND (orig_declarator, 1),
+                             NULL_TREE);
+       }
     }
 
   /* Caller will do the rest of this.  */
index 0c72619bd0d60be41661ceab30c35d005313d186..c75481956374a56a7f9157ac465e3671f0eafc45 100644 (file)
@@ -872,7 +872,7 @@ dump_decl (t, v)
       break;
 
     case LOOKUP_EXPR:
-      OB_PUTID (TREE_OPERAND (t, 0));
+      dump_decl (TREE_OPERAND (t, 0), v);
       break;
 
     case LABEL_DECL: