This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] [C++] Fix PR 13268 and 13339 (error-recovery problems)


The problem here is that the C++ front-end not allows tests for error_mark_node, this patch fixes that for the two testcases here. I cannot remember which part of the
patch fixes which bug.



OK, bootstrapped on powerpc-apple-darwin7.2 with no regressions?


ChangeLog:
* class.c (add_method): Return early when method is error_mark_node.
* decl.c (grokparms): Continue also if the type of decl is null.
* pt.c (tsubst_friend_function): Return early when new_friend is error_mark_node.



Patch: Index: class.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v retrieving revision 1.590 diff -u -p -r1.590 class.c --- class.c 21 Dec 2003 21:07:29 -0000 1.590 +++ class.c 24 Dec 2003 17:51:22 -0000 @@ -725,12 +725,18 @@ modify_vtable_entry (tree t, void add_method (tree type, tree method, int error_p) { - int using = (DECL_CONTEXT (method) != type); + int using; int len; int slot; tree method_vec; - int template_conv_p = (TREE_CODE (method) == TEMPLATE_DECL - && DECL_TEMPLATE_CONV_FN_P (method)); + int template_conv_p; + + if (method == error_mark_node) + return; + + using = (DECL_CONTEXT (method) != type); + template_conv_p = (TREE_CODE (method) == TEMPLATE_DECL + && DECL_TEMPLATE_CONV_FN_P (method));

if (!CLASSTYPE_METHOD_VEC (type))
/* Make a new method vector. We start with 8 entries. We must
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1167
diff -u -p -r1.1167 decl.c
--- decl.c 22 Dec 2003 23:57:06 -0000 1.1167
+++ decl.c 24 Dec 2003 17:51:29 -0000
@@ -8598,7 +8598,7 @@ grokparms (tree first_parm)
split_specs_attrs (TREE_PURPOSE (decl), &specs, &attrs);
decl = grokdeclarator (TREE_VALUE (decl), specs,
PARM, init != NULL_TREE, &attrs);
- if (! decl || TREE_TYPE (decl) == error_mark_node)
+ if (! decl || !TREE_TYPE (decl) || TREE_TYPE (decl) == error_mark_node )
continue;


       if (attrs)
Index: pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.807
diff -u -p -r1.807 pt.c
--- pt.c	22 Dec 2003 23:57:06 -0000	1.807
+++ pt.c	24 Dec 2003 17:51:30 -0000
@@ -4897,6 +4897,9 @@ tsubst_friend_function (tree decl, tree

      Then, in S<int>, template <class U> void f(int, U) is not an
      instantiation of anything.  */
+  if (new_friend == error_mark_node)
+    return error_mark_node;
+
   DECL_USE_TEMPLATE (new_friend) = 0;
   if (TREE_CODE (decl) == TEMPLATE_DECL)
     {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]