From 9076e2922fdeffc316f0a729711116c3c3c258ec Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 28 Jul 2000 02:05:11 -0400 Subject: [PATCH] decl.c (duplicate_decls): If common_type produces a non-typedef type for a typedef, just use the old type. * 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 | 10 ++++++++-- gcc/cp/cp-tree.h | 8 +++++--- gcc/cp/decl.c | 5 +++++ gcc/cp/pt.c | 2 +- gcc/cp/typeck.c | 19 +++++++++---------- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e032ce2..d4604c4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2000-07-27 Jason Merrill + + * 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 * cp-tree.h (function_depth): Declare. @@ -12,8 +17,9 @@ 2000-07-27 Jason Merrill - * 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 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 6e592ca..56ec82d 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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. */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3beeb8d..020dd30 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d5a75ca..ecabed9 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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. */ diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 0df8a03..e7f8d2f 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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)) -- 2.7.4