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]

Re: [C++ PATCH for 3.1] Fix PR6716 regression (take 2)



For non-template, it's not added to TYPE_FIELDS.  (grokdeclarator detects
the error and produce a FIELD_DECL with error_mark_node as type.  Then in
finish_member_declaration, it handles this error_mark_node by not adding
it to TYPE_FIELDS.)
OK, so that's what we should do for templates too.

Something like this patch should help.

Index: pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.594
diff -c -p -r1.594 pt.c
*** pt.c	25 Jun 2002 15:35:26 -0000	1.594
--- pt.c	27 Jun 2002 16:22:21 -0000
*************** instantiate_class_template (type)
*** 5222,5228 ****
 	    if (DECL_INITIALIZED_IN_CLASS_P (r))
 	      check_static_variable_definition (r, TREE_TYPE (r));
 	  }
! 	
 	/* R will have a TREE_CHAIN if and only if it has already been
 	   processed by finish_member_declaration.  This can happen
 	   if, for example, it is a TYPE_DECL for a class-scoped
--- 5222,5230 ----
 	    if (DECL_INITIALIZED_IN_CLASS_P (r))
 	      check_static_variable_definition (r, TREE_TYPE (r));
 	  }
! 	else if (TREE_CODE (t) == FIELD_DECL)
! 	  TREE_TYPE (t) = require_complete_type (t);
!
 	/* R will have a TREE_CHAIN if and only if it has already been
 	   processed by finish_member_declaration.  This can happen
 	   if, for example, it is a TYPE_DECL for a class-scoped
*************** instantiate_class_template (type)
*** 5302,5314 ****
       if (TREE_CODE (friend_type) == TEMPLATE_DECL)
 	--processing_template_decl;
     }
-
-   for (t = TYPE_FIELDS (type); t; t = TREE_CHAIN (t))
-     if (TREE_CODE (t) == FIELD_DECL)
-       {
- 	TREE_TYPE (t) = complete_type (TREE_TYPE (t));
- 	require_complete_type (t);
-       }

   /* Set the file and line number information to whatever is given for
      the class itself.  This puts error messages involving generated
--- 5304,5309 ----


--
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com


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