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
This commit is contained in:
Jason Merrill 2000-07-28 02:05:11 -04:00 committed by Jason Merrill
parent fb41a10659
commit 9076e2922f
5 changed files with 28 additions and 16 deletions

View 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>

View 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. */

View 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

View 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. */

View 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))