+1999-08-09 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (build_ptrmemfunc_type): Handle qualified
+ pointer-to-member types here.
+ * tree.c (cp_build_qualified_type_real): Simplify handling here.
+
1999-08-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* decl.c: Remove redundant prototype for `print_error_function'.
tree fields[4];
tree t;
tree u;
+ tree unqualified_variant = NULL_TREE;
/* If a canonical type already exists for this type, use it. We use
this method instead of type_hash_canon, because it only does a
if ((t = TYPE_GET_PTRMEMFUNC_TYPE (type)))
return t;
+ /* Make sure that we always have the unqualified pointer-to-member
+ type first. */
+ if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED)
+ unqualified_variant
+ = build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type));
+
push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type));
u = make_lang_type (UNION_TYPE);
information for this anonymous RECORD_TYPE. */
TYPE_NAME (t) = NULL_TREE;
+ /* If this is not the unqualified form of this pointer-to-member
+ type, set the TYPE_MAIN_VARIANT for this type to be the
+ unqualified type. Since they are actually RECORD_TYPEs that are
+ not variants of each other, we must do this manually. */
+ if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED)
+ {
+ t = build_qualified_type (t, CP_TYPE_QUALS (type));
+ TYPE_MAIN_VARIANT (t) = unqualified_variant;
+ TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant);
+ TYPE_NEXT_VARIANT (unqualified_variant) = t;
+ }
+
+ /* Cache this pointer-to-member type so that we can find it again
+ later. */
TYPE_SET_PTRMEMFUNC_TYPE (type, t);
/* Seems to be wanted. */
CLASSTYPE_GOT_SEMICOLON (t) = 1;
+
return t;
}
t = TYPE_PTRMEMFUNC_FN_TYPE (type);
t = cp_build_qualified_type_real (t, type_quals, complain);
- return build_qualified_type (build_ptrmemfunc_type (t), type_quals);
+ return build_ptrmemfunc_type (t);
}
/* Retrieve (or create) the appropriately qualified variant. */