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]

(C++) patch for class-key consistency


We were ignoring the class-key used on a definition of a class template
specialization.  This fixes that.

1998-11-23  Jason Merrill  <jason@yorick.cygnus.com>

	* parse.y (named_class_head): Update CLASSTYPE_DECLARED_CLASS.

Index: parse.y
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/parse.y,v
retrieving revision 1.102
diff -c -p -r1.102 parse.y
*** parse.y	1998/11/21 05:42:16	1.102
--- parse.y	1998/11/23 11:04:02
*************** named_class_head:
*** 2242,2253 ****
  		{ 
                    pop_scope (CP_DECL_CONTEXT ($1));
  		  $$ = TREE_TYPE ($1);
! 		  if (TREE_INT_CST_LOW (current_aggr) == union_type 
  		      && TREE_CODE ($$) != UNION_TYPE)
  		    cp_pedwarn ("`union' tag used in declaring `%#T'", $$);
  		  else if (TREE_CODE ($$) == UNION_TYPE
! 			   && TREE_INT_CST_LOW (current_aggr) != union_type)
  		    cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
  		  if ($3)
  		    {
  		      maybe_process_partial_specialization ($$);
--- 2242,2258 ----
  		{ 
                    pop_scope (CP_DECL_CONTEXT ($1));
  		  $$ = TREE_TYPE ($1);
! 		  if (current_aggr == union_type_node
  		      && TREE_CODE ($$) != UNION_TYPE)
  		    cp_pedwarn ("`union' tag used in declaring `%#T'", $$);
  		  else if (TREE_CODE ($$) == UNION_TYPE
! 			   && current_aggr != union_type_node)
  		    cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
+ 		  else if (TREE_CODE ($$) == RECORD_TYPE)
+ 		    /* We might be specializing a template with a different
+ 		       class-key; deal.  */
+ 		    CLASSTYPE_DECLARED_CLASS ($$) = (current_aggr
+ 						     == class_type_node);
  		  if ($3)
  		    {
  		      maybe_process_partial_specialization ($$);


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