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 template/exception-handling regression



This patch fixes a regression whereby we could crash when combining
templates with exception-handling.

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

1999-10-07  Mark Mitchell  <mark@codesourcery.com>

	* pt.c (tsubst_expr): Set DECL_TEMPLATE_INSTANTIATED for a catch
	paramter.

Index: testsuite/g++.old-deja/g++.eh/tmpl6.C
===================================================================
RCS file: tmpl6.C
diff -N tmpl6.C
*** /dev/null	Sat Dec  5 20:30:03 1998
--- tmpl6.C	Thu Oct  7 22:38:49 1999
***************
*** 0 ****
--- 1,18 ----
+ // Build don't link:
+ // Origin: Mark Mitchell <mark@codesourcery.com>
+ 
+ struct S
+ {
+   int i;
+ };
+ 
+ template <class T>
+ void f ()
+ {
+   try {
+   } catch (S& s) {
+     s.i = 3;
+   }
+ }
+ 
+ template void f<int>();
Index: cp/pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.372
diff -c -p -r1.372 pt.c
*** pt.c	1999/10/04 09:33:28	1.372
--- pt.c	1999/10/08 05:38:58
*************** tsubst_expr (t, args, complain, in_decl)
*** 7424,7429 ****
--- 7424,7433 ----
  	  {
  	    decl = DECL_STMT_DECL (HANDLER_PARMS (t));
  	    decl = tsubst (decl, args, complain, in_decl);
+ 	    /* Prevent instantiate_decl from trying to instantiate
+ 	       this variable.  We've already done all that needs to be
+ 	       done.  */
+ 	    DECL_TEMPLATE_INSTANTIATED (decl) = 1;
  	  }
  	else
  	  decl = NULL_TREE;


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