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]

[C++ PATCH] Fix 21151


This patch fixes 21151, a PCH ICE. To improve PCH performance we mangle the names of symbols that will be placed in the PCH file early on. Unfortunately this means we can mangle some names that can never be needed -- a local class in a template definition for instance. It seems more prudent to merely push such names onto the local class list so mangling works, rather than try and figure out we don't really need the name.

built & tested on i686-pc-linux-gnu, installed 4.0 and mainline

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2005-06-01  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/21151
	* name-lookup.c (pushtag): Push local class even in a template.

Index: cp/name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.121
diff -c -3 -p -r1.121 name-lookup.c
*** cp/name-lookup.c	30 May 2005 16:20:14 -0000	1.121
--- cp/name-lookup.c	1 Jun 2005 15:26:17 -0000
*************** pushtag (tree name, tree type, tag_scope
*** 4698,4705 ****
  	     way.  (It's otherwise tricky to find a member function definition
  	     it's only pointed to from within a local class.)  */
  	  if (TYPE_CONTEXT (type)
! 	      && TREE_CODE (TYPE_CONTEXT (type)) == FUNCTION_DECL
! 	      && !processing_template_decl)
  	    VEC_safe_push (tree, gc, local_classes, type);
          }
        if (b->kind == sk_class
--- 4698,4704 ----
  	     way.  (It's otherwise tricky to find a member function definition
  	     it's only pointed to from within a local class.)  */
  	  if (TYPE_CONTEXT (type)
! 	      && TREE_CODE (TYPE_CONTEXT (type)) == FUNCTION_DECL)
  	    VEC_safe_push (tree, gc, local_classes, type);
          }
        if (b->kind == sk_class
#include "local-1.H"
int main() 
{
  func<int> ();
  return 0;
}
template<typename T> void func()   
{   
  struct object   
  {   
    object() {}
  };   
}  

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