Commit 9076e292 by Jason Merrill Committed by Jason Merrill

decl.c (duplicate_decls): If common_type produces a non-typedef type for a…

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
parent fb41a106
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> 2000-07-27 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (function_depth): Declare. * cp-tree.h (function_depth): Declare.
...@@ -12,8 +17,9 @@ ...@@ -12,8 +17,9 @@
2000-07-27 Jason Merrill <jason@redhat.com> 2000-07-27 Jason Merrill <jason@redhat.com>
* typeck.c (common_type): If we're just returning one of our * pt.c (for_each_template_parm_r, case RECORD_TYPE): Use
arguments, don't strip typedef types. TYPE_PTRMEMFUNC_P.
* cp-tree.h (TYPE_TEMPLATE_INFO): Check for TYPE_LANG_SPECIFIC.
2000-07-26 Mark Mitchell <mark@codesourcery.com> 2000-07-26 Mark Mitchell <mark@codesourcery.com>
......
...@@ -2309,10 +2309,12 @@ struct lang_decl ...@@ -2309,10 +2309,12 @@ struct lang_decl
/* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */ /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */
#define TYPE_TEMPLATE_INFO(NODE) \ #define TYPE_TEMPLATE_INFO(NODE) \
(TREE_CODE (NODE) == ENUMERAL_TYPE \ (TREE_CODE (NODE) == ENUMERAL_TYPE \
? ENUM_TEMPLATE_INFO (NODE) : \ ? ENUM_TEMPLATE_INFO (NODE) : \
(TREE_CODE (NODE) == TEMPLATE_TEMPLATE_PARM \ (TREE_CODE (NODE) == TEMPLATE_TEMPLATE_PARM \
? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) \ ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) : \
: CLASSTYPE_TEMPLATE_INFO (NODE))) (TYPE_LANG_SPECIFIC (NODE) \
? CLASSTYPE_TEMPLATE_INFO (NODE) \
: NULL_TREE)))
/* Set the template information for an ENUMERAL_, RECORD_, or /* Set the template information for an ENUMERAL_, RECORD_, or
UNION_TYPE to VAL. */ UNION_TYPE to VAL. */
......
...@@ -3526,6 +3526,11 @@ duplicate_decls (newdecl, olddecl) ...@@ -3526,6 +3526,11 @@ duplicate_decls (newdecl, olddecl)
/* Merge the data types specified in the two decls. */ /* Merge the data types specified in the two decls. */
newtype = common_type (TREE_TYPE (newdecl), TREE_TYPE (olddecl)); 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) if (TREE_CODE (newdecl) == VAR_DECL)
DECL_THIS_EXTERN (newdecl) |= DECL_THIS_EXTERN (olddecl); DECL_THIS_EXTERN (newdecl) |= DECL_THIS_EXTERN (olddecl);
/* Do this after calling `common_type' so that default /* Do this after calling `common_type' so that default
......
...@@ -4133,7 +4133,7 @@ for_each_template_parm_r (tp, walk_subtrees, d) ...@@ -4133,7 +4133,7 @@ for_each_template_parm_r (tp, walk_subtrees, d)
switch (TREE_CODE (t)) switch (TREE_CODE (t))
{ {
case RECORD_TYPE: case RECORD_TYPE:
if (TYPE_PTRMEMFUNC_FLAG (t)) if (TYPE_PTRMEMFUNC_P (t))
break; break;
/* Fall through. */ /* Fall through. */
......
...@@ -521,27 +521,26 @@ composite_pointer_type (t1, t2, arg1, arg2, location) ...@@ -521,27 +521,26 @@ composite_pointer_type (t1, t2, arg1, arg2, location)
converted to integer types. */ converted to integer types. */
tree tree
common_type (orig_t1, orig_t2) common_type (t1, t2)
tree orig_t1, orig_t2; tree t1, t2;
{ {
register enum tree_code code1; register enum tree_code code1;
register enum tree_code code2; register enum tree_code code2;
tree attributes; tree attributes;
tree t1, t2;
/* Save time if the two types are the same. */ /* 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) 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 one type is nonsense, use the other. */
if (t1 == error_mark_node) if (t1 == error_mark_node)
return orig_t2; return t2;
if (t2 == error_mark_node) if (t2 == error_mark_node)
return orig_t1; return t1;
if ((ARITHMETIC_TYPE_P (t1) || TREE_CODE (t1) == ENUMERAL_TYPE) if ((ARITHMETIC_TYPE_P (t1) || TREE_CODE (t1) == ENUMERAL_TYPE)
&& (ARITHMETIC_TYPE_P (t2) || TREE_CODE (t2) == ENUMERAL_TYPE)) && (ARITHMETIC_TYPE_P (t2) || TREE_CODE (t2) == ENUMERAL_TYPE))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment