* call.c (build_op_delete_call): Avoid creating unnecessary types.
* class.c (instantiate_type): Remove tests for tf_no_attributes.
* cp-tree.h (tsubst_flags_t): Remove tf_no_attributes.
(COMPARE_NO_ATTRIBUTES): Remove.
* typeck.c (comptypes): Do not check COMPARE_NO_ATTRIBUTES.
From-SVN: r66843
2003-05-15 Mark Mitchell <mark@codesourcery.com>
+ * call.c (build_op_delete_call): Avoid creating unnecessary types.
+ * class.c (instantiate_type): Remove tests for tf_no_attributes.
+ * cp-tree.h (tsubst_flags_t): Remove tf_no_attributes.
+ (COMPARE_NO_ATTRIBUTES): Remove.
+ * typeck.c (comptypes): Do not check COMPARE_NO_ATTRIBUTES.
+
PR c++/8385
* semantics.c (finish_typeof): Refine type-dependency check.
int flags, tree placement)
{
tree fn = NULL_TREE;
- tree fns, fnname, fntype, argtypes, args, type;
+ tree fns, fnname, argtypes, args, type;
int pass;
if (addr == error_mark_node)
the second pass we look for a two-argument delete. */
for (pass = 0; pass < (placement ? 1 : 2); ++pass)
{
- if (pass == 0)
- argtypes = tree_cons (NULL_TREE, ptr_type_node, argtypes);
- else
- /* Normal delete; now try to find a match including the size
- argument. */
- argtypes = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, sizetype,
- void_list_node));
- fntype = build_function_type (void_type_node, argtypes);
-
/* Go through the `operator delete' functions looking for one
with a matching type. */
for (fn = BASELINK_P (fns) ? BASELINK_FUNCTIONS (fns) : fns;
{
tree t;
- /* Exception specifications on the `delete' operator do not
- matter. */
- t = build_exception_variant (TREE_TYPE (OVL_CURRENT (fn)),
- NULL_TREE);
- /* We also don't compare attributes. We're really just
- trying to check the types of the first two parameters. */
- if (comptypes (t, fntype, COMPARE_NO_ATTRIBUTES))
+ /* The first argument must be "void *". */
+ t = TYPE_ARG_TYPES (TREE_TYPE (OVL_CURRENT (fn)));
+ if (!same_type_p (TREE_VALUE (t), ptr_type_node))
+ continue;
+ t = TREE_CHAIN (t);
+ /* On the first pass, check the rest of the arguments. */
+ if (pass == 0)
+ {
+ while (argtypes && t)
+ {
+ if (!same_type_p (TREE_VALUE (argtypes),
+ TREE_VALUE (t)))
+ break;
+ argtypes = TREE_CHAIN (argtypes);
+ t = TREE_CHAIN (t);
+ }
+ if (!argtypes && !t)
+ break;
+ }
+ /* On the second pass, the second argument must be
+ "size_t". */
+ else if (pass == 1
+ && same_type_p (TREE_VALUE (t), sizetype)
+ && TREE_CHAIN (t) == void_list_node)
break;
}
instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
{
int complain = (flags & tf_error);
- int strict = (flags & tf_no_attributes)
- ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT;
int allow_ptrmem = flags & tf_ptrmem_ok;
flags &= ~tf_ptrmem_ok;
if (TREE_TYPE (rhs) != NULL_TREE && ! (type_unknown_p (rhs)))
{
- if (comptypes (lhstype, TREE_TYPE (rhs), strict))
+ if (same_type_p (lhstype, TREE_TYPE (rhs)))
return rhs;
if (flag_ms_extensions
&& TYPE_PTRMEMFUNC_P (lhstype)
tf_none = 0, /* nothing special */
tf_error = 1 << 0, /* give error messages */
tf_warning = 1 << 1, /* give warnings too */
- tf_no_attributes = 1 << 2, /* ignore attributes on comparisons
- (instantiate_type use) */
- tf_ignore_bad_quals = 1 << 3, /* ignore bad cvr qualifiers */
- tf_keep_type_decl = 1 << 4, /* retain typedef type decls
+ tf_ignore_bad_quals = 1 << 2, /* ignore bad cvr qualifiers */
+ tf_keep_type_decl = 1 << 3, /* retain typedef type decls
(make_typename_type use) */
- tf_ptrmem_ok = 1 << 5 /* pointers to member ok (internal
+ tf_ptrmem_ok = 1 << 4 /* pointers to member ok (internal
instantiate_type use) */
} tsubst_flags_t;
#define COMPARE_REDECLARATION 4 /* The comparsion is being done when
another declaration of an existing
entity is seen. */
-#define COMPARE_NO_ATTRIBUTES 8 /* The comparison should ignore
- extra-linguistic type attributes. */
/* Used with push_overloaded_decl. */
#define PUSH_GLOBAL 0 /* Push the DECL into namespace scope,
if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
return 1;
- if (strict & COMPARE_NO_ATTRIBUTES)
- attrval = 1;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
- else if (! (attrval = (*targetm.comp_type_attributes) (t1, t2)))
- return 0;
+ if (! (attrval = (*targetm.comp_type_attributes) (t1, t2)))
+ return 0;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
val = 0;