+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.
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>
/* 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. */
/* 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
switch (TREE_CODE (t))
{
case RECORD_TYPE:
- if (TYPE_PTRMEMFUNC_FLAG (t))
+ if (TYPE_PTRMEMFUNC_P (t))
break;
/* Fall through. */
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))