This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: (C++) Patch for typedef redeclaration
- To: gcc-patches at gcc dot gnu dot org
- Subject: Re: (C++) Patch for typedef redeclaration
- From: Jason Merrill <jason at redhat dot com>
- Date: 27 Jul 2000 23:00:25 -0700
- References: <200007271819.LAA30030@casey.cygnus.com>
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