C++ PATCH: PR 13179

Mark Mitchell mark@codesourcery.com
Thu Dec 4 05:03:00 GMT 2003


This simple patch fixes a regression introduced by an unnamed party
who tweaked exception-handling typeinfo generation.  Hint to folks
modifying the C++ front end: always think about whether the change
you're making makes sense if you are in a template!

Tested on i686-pc-linux-gnu, applied on the mainline.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2003-12-03  Mark Mitchell  <mark@codesourcery.com>

	PR c++/13179
	* semantics.c (finish_handler_parms): Do not call eh_type_info for
	types used in templates.

2003-12-03  Mark Mitchell  <mark@codesourcery.com>

	PR c++/13179
	* g++.dg/template/eh1.C: New test.

Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.373
diff -c -5 -p -r1.373 semantics.c
*** cp/semantics.c	18 Nov 2003 15:54:21 -0000	1.373
--- cp/semantics.c	4 Dec 2003 04:47:41 -0000
*************** finish_handler_parms (tree decl, tree ha
*** 958,968 ****
      }
    else
      type = expand_start_catch_block (decl);
  
    HANDLER_TYPE (handler) = type;
!   if (type)
      mark_used (eh_type_info (type));
  }
  
  /* Finish a handler, which may be given by HANDLER.  The BLOCKs are
     the return value from the matching call to finish_handler_parms.  */
--- 958,968 ----
      }
    else
      type = expand_start_catch_block (decl);
  
    HANDLER_TYPE (handler) = type;
!   if (!processing_template_decl && type)
      mark_used (eh_type_info (type));
  }
  
  /* Finish a handler, which may be given by HANDLER.  The BLOCKs are
     the return value from the matching call to finish_handler_parms.  */
Index: testsuite/g++.dg/template/eh1.C
===================================================================
RCS file: testsuite/g++.dg/template/eh1.C
diff -N testsuite/g++.dg/template/eh1.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/template/eh1.C	4 Dec 2003 04:47:43 -0000
***************
*** 0 ****
--- 1,6 ----
+ template <class T>
+ void foo()
+ {
+   try {}
+   catch(T e) {}
+ }



More information about the Gcc-patches mailing list