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]

PATCH for explicit69.C



Here's a patch to the regression that Joe Buck found in explicit69.C.
It's 100% safe, since all it does is remove an assertion, so it should
probably go on the 1.1 branch as well.  Jason?

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com

1998-08-09  Mark Mitchell  <mark@markmitchell.com>

	* pt.c (check_explicit_specialization): Don't abort on bogus
	explicit instantiations.

Index: testsuite/g++.old-deja/g++.pt/explicit69.C
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/testsuite/g++.old-deja/g++.pt/explicit69.C,v
retrieving revision 1.2
diff -c -p -r1.2 explicit69.C
*** explicit69.C	1998/07/14 16:20:47	1.2
--- explicit69.C	1998/08/09 22:09:52
***************
*** 1,2 ****
  //Build don't link:
! template class x {}; // ERROR - not a template instantiation XFAIL *-*-*
--- 1,2 ----
  //Build don't link:
! template class x {}; // ERROR - not a template instantiation
Index: cp/pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.175
diff -c -p -r1.175 pt.c
*** pt.c	1998/08/07 16:33:32	1.175
--- pt.c	1998/08/09 22:10:14
*************** check_explicit_specialization (declarato
*** 1205,1223 ****
  
        if (ctype != NULL_TREE && TYPE_BEING_DEFINED (ctype))
  	{
! 	  /* Since finish_struct_1 has not been called yet, we
! 	     can't call lookup_fnfields.  We note that this
! 	     template is a specialization, and proceed, letting
! 	     finish_struct fix this up later.  */
! 	  tree ti = perm_tree_cons (NULL_TREE, 
! 				    TREE_OPERAND (declarator, 1),
! 				    NULL_TREE);
! 	  TI_PENDING_SPECIALIZATION_FLAG (ti) = 1;
! 	  DECL_TEMPLATE_INFO (decl) = ti;
! 	  /* This should not be an instantiation; explicit
! 	     instantiation directives can only occur at the top
! 	     level.  */
! 	  my_friendly_assert (!explicit_instantiation, 0);
  	  return decl;
  	}
        else if (ctype != NULL_TREE 
--- 1205,1237 ----
  
        if (ctype != NULL_TREE && TYPE_BEING_DEFINED (ctype))
  	{
! 	  if (!explicit_instantiation)
! 	    {
! 	      /* Since finish_struct_1 has not been called yet, we
! 		 can't call lookup_fnfields.  We note that this
! 		 template is a specialization, and proceed, letting
! 		 finish_struct fix this up later.  */
! 	      tree ti = perm_tree_cons (NULL_TREE, 
! 					TREE_OPERAND (declarator, 1),
! 					NULL_TREE);
! 	      TI_PENDING_SPECIALIZATION_FLAG (ti) = 1;
! 	      DECL_TEMPLATE_INFO (decl) = ti;
! 	    }
! 	  else
! 	    /* It's not legal to write an explicit instantiation in
! 	       class scope, e.g.:
! 
! 	         class C { template void f(); }
! 
! 	       This case is caught by the parser.  However, on
! 	       something like:
! 	       
! 	         template class C { void f(); };
! 
! 	       (which is illegal) we can get here.  The error will be
! 	       issued later.  */
! 	    ;
! 
  	  return decl;
  	}
        else if (ctype != NULL_TREE 


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