pt.c (check_explicit_specialization): If DECLARATOR turned into an error_mark_node...
authorBrendan Kehoe <brendan@cygnus.com>
Fri, 12 Jun 1998 12:56:22 +0000 (12:56 +0000)
committerBrendan Kehoe <brendan@gcc.gnu.org>
Fri, 12 Jun 1998 12:56:22 +0000 (08:56 -0400)
* pt.c (check_explicit_specialization): If DECLARATOR turned into
an error_mark_node from lookup_template_function, return the same.
(determine_specialization): Also make sure TEMPLATE_ID isn't an
error_mark_node, before we try to read its operands.
* decl.c (grokdeclarator): If we got an error_mark_node from
check_explicit_specialization, just return it right back.

From-SVN: r20444

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/pt.c

index aced36520885a1cd92fa4e43773fdcb7a6e68bd2..ee9d746318b59f8b09a7b9ca7338ad3d8543beae 100644 (file)
@@ -1,3 +1,12 @@
+1998-06-12  Brendan Kehoe  <brendan@cygnus.com>
+
+       * pt.c (check_explicit_specialization): If DECLARATOR turned into
+       an error_mark_node from lookup_template_function, return the same.
+       (determine_specialization): Also make sure TEMPLATE_ID isn't an
+       error_mark_node, before we try to read its operands.
+       * decl.c (grokdeclarator): If we got an error_mark_node from
+       check_explicit_specialization, just return it right back.
+
 1998-06-12  Mark Mitchell  <mark@markmitchell.com>
 
        * class.c (instantiate_type): Don't treat template-ids that don't
index dbe9f5f8d38290f962fc77ba4ee133dba15c4217..e6c5fff4086504ec38bd9f434a74fe64556e8cd7 100644 (file)
@@ -10193,6 +10193,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
        if (decl == NULL_TREE)
          return NULL_TREE;
 
+       /* Among other times, could occur from check_explicit_specialization
+          returning an error_mark_node.  */
+       if (decl == error_mark_node)
+         return error_mark_node;
+
        if (ctype == NULL_TREE && DECL_LANGUAGE (decl) != lang_c
            && (! DECL_USE_TEMPLATE (decl) ||
                name_mangling_version < 1)) 
index 537361edbc5e0830576cf3ca50dd98f111d1d043..69856b7e8ddb2fb63f420008fb238dea47d922f2 100644 (file)
@@ -784,14 +784,19 @@ determine_specialization (template_id, decl, targs_out,
      int need_member_template;
      int complain;
 {
-  tree fns = TREE_OPERAND (template_id, 0);
-  tree targs_in = TREE_OPERAND (template_id, 1);
+  tree fns, targs_in;
   tree templates = NULL_TREE;
   tree fn;
   int i;
 
   *targs_out = NULL_TREE;
 
+  if (template_id == error_mark_node)
+    return error_mark_node;
+
+  fns = TREE_OPERAND (template_id, 0);
+  targs_in = TREE_OPERAND (template_id, 1);
+
   if (fns == error_mark_node)
     return error_mark_node;
 
@@ -1084,7 +1089,10 @@ check_explicit_specialization (declarator, decl, template_count, flags)
            lookup_template_function (fns, NULL_TREE);
        }
 
-      if (TREE_CODE (TREE_OPERAND (declarator, 0)) == LOOKUP_EXPR) 
+      if (declarator == error_mark_node)
+       return error_mark_node;
+
+      if (TREE_CODE (TREE_OPERAND (declarator, 0)) == LOOKUP_EXPR)
        {
          /* A friend declaration.  We can't do much, because we don't
           know what this resolves to, yet.  */