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 template crash



Here's a small patch to avoid a crash on the following:

  // Build don't link:

  template <int B>
  class foo;

  template <class U>
  class bar
  {
    typedef foo<(U::id > 0)> foobar;
  };

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

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

	* decl2.c (grokfield): Don't mangle the name of a TYPE_DECL if it
	uses template parameters.

Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.109
diff -c -p -r1.109 decl2.c
*** decl2.c	1998/07/28 01:02:52	1.109
--- decl2.c	1998/08/03 16:56:45
*************** grokfield (declarator, declspecs, init, 
*** 1642,1649 ****
        /* Now that we've updated the context, we need to remangle the
  	 name for this TYPE_DECL.  */
        DECL_ASSEMBLER_NAME (value) = DECL_NAME (value);
!       DECL_ASSEMBLER_NAME (value) =
! 	get_identifier (build_overload_name (TREE_TYPE (value), 1, 1));
  
        pushdecl_class_level (value);
        return value;
--- 1642,1650 ----
        /* Now that we've updated the context, we need to remangle the
  	 name for this TYPE_DECL.  */
        DECL_ASSEMBLER_NAME (value) = DECL_NAME (value);
!       if (!uses_template_parms (value))
! 	DECL_ASSEMBLER_NAME (value) =
! 	  get_identifier (build_overload_name (TREE_TYPE (value), 1, 1));
  
        pushdecl_class_level (value);
        return value;


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