decl.c (duplicate_decls): If common_type produces a non-typedef type for a typedef...
authorJason Merrill <jason@redhat.com>
Fri, 28 Jul 2000 06:05:11 +0000 (02:05 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 28 Jul 2000 06:05:11 +0000 (02:05 -0400)
        * decl.c (duplicate_decls): If common_type produces a non-typedef
        type for a typedef, just use the old type.

        * pt.c (for_each_template_parm_r, case RECORD_TYPE): Use
        TYPE_PTRMEMFUNC_P.
        * cp-tree.h (TYPE_TEMPLATE_INFO): Check for TYPE_LANG_SPECIFIC.

From-SVN: r35311

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/pt.c
gcc/cp/typeck.c

index e032ce2..d4604c4 100644 (file)
@@ -1,3 +1,8 @@
+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.
+
 2000-07-27  Mark Mitchell  <mark@codesourcery.com>
 
        * cp-tree.h (function_depth): Declare.
@@ -12,8 +17,9 @@
 
 2000-07-27  Jason Merrill  <jason@redhat.com>
 
-       * typeck.c (common_type): If we're just returning one of our
-       arguments, don't strip typedef types.
+       * pt.c (for_each_template_parm_r, case RECORD_TYPE): Use
+       TYPE_PTRMEMFUNC_P.
+       * cp-tree.h (TYPE_TEMPLATE_INFO): Check for TYPE_LANG_SPECIFIC.
 
 2000-07-26  Mark Mitchell  <mark@codesourcery.com>
 
index 6e592ca..56ec82d 100644 (file)
@@ -2309,10 +2309,12 @@ struct lang_decl
 /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE.  */
 #define TYPE_TEMPLATE_INFO(NODE)                       \
   (TREE_CODE (NODE) == ENUMERAL_TYPE                   \
-   ? ENUM_TEMPLATE_INFO (NODE) :                       \
+   ? ENUM_TEMPLATE_INFO (NODE) :                       \
    (TREE_CODE (NODE) == TEMPLATE_TEMPLATE_PARM         \
-    ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE)      \
-    : CLASSTYPE_TEMPLATE_INFO (NODE)))
+    ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) :    \
+    (TYPE_LANG_SPECIFIC (NODE)                         \
+     ? CLASSTYPE_TEMPLATE_INFO (NODE)                  \
+     : NULL_TREE)))
 
 /* Set the template information for an ENUMERAL_, RECORD_, or
    UNION_TYPE to VAL.  */
index 3beeb8d..020dd30 100644 (file)
@@ -3526,6 +3526,11 @@ duplicate_decls (newdecl, olddecl)
       /* 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 d5a75ca..ecabed9 100644 (file)
@@ -4133,7 +4133,7 @@ for_each_template_parm_r (tp, walk_subtrees, d)
   switch (TREE_CODE (t))
     {
     case RECORD_TYPE:
-      if (TYPE_PTRMEMFUNC_FLAG (t))
+      if (TYPE_PTRMEMFUNC_P (t))
        break;
       /* Fall through.  */
 
index 0df8a03..e7f8d2f 100644 (file)
@@ -521,27 +521,26 @@ composite_pointer_type (t1, t2, arg1, arg2, location)
    converted to integer types.  */
 
 tree
-common_type (orig_t1, orig_t2)
-     tree orig_t1, orig_t2;
+common_type (t1, t2)
+     tree t1, t2;
 {
   register enum tree_code code1;
   register enum tree_code code2;
   tree attributes;
-  tree t1, t2;
 
   /* Save time if the two types are the same.  */
-  if (orig_t1 == orig_t2)
-    return orig_t1;
-  t1 = original_type (orig_t1);
-  t2 = original_type (orig_t2);
   if (t1 == t2)
-    return orig_t1;
+    return t1;
+  t1 = original_type (t1);
+  t2 = original_type (t2);
+  if (t1 == t2)
+    return t1;
 
   /* If one type is nonsense, use the other.  */
   if (t1 == error_mark_node)
-    return orig_t2;
+    return t2;
   if (t2 == error_mark_node)
-    return orig_t1;
+    return t1;
 
   if ((ARITHMETIC_TYPE_P (t1) || TREE_CODE (t1) == ENUMERAL_TYPE)
       && (ARITHMETIC_TYPE_P (t2) || TREE_CODE (t2) == ENUMERAL_TYPE))