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]

Re: (C++) Patch for typedef redeclaration


That last patch didn't really fix the problem, so I've taken a more direct
approach:

2000-07-27  Jason Merrill  <jason@redhat.com>

	* decl.c (duplicate_decls): If common_type produces a non-typedef
	type for a typedef, just use the old type.

Index: decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.662
diff -c -p -r1.662 decl.c
*** decl.c	2000/07/27 04:49:17	1.662
--- decl.c	2000/07/28 05:19:32
*************** duplicate_decls (newdecl, olddecl)
*** 3522,3527 ****
--- 3522,3532 ----
        /* Merge the data types specified in the two decls.  */
        newtype = common_type (TREE_TYPE (newdecl), TREE_TYPE (olddecl));
  
+       /* If common_type produces a non-typedef type, just use the old type.  */
+       if (TREE_CODE (newdecl) == TYPE_DECL
+ 	  && newtype == DECL_ORIGINAL_TYPE (newdecl))
+ 	newtype = oldtype;
+ 
        if (TREE_CODE (newdecl) == VAR_DECL)
  	DECL_THIS_EXTERN (newdecl) |= DECL_THIS_EXTERN (olddecl);
        /* Do this after calling `common_type' so that default

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