/* A default parameter has been added. Adjust the
clone's parameters. */
tree exceptions = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (clone));
+ tree attrs = TYPE_ATTRIBUTES (TREE_TYPE (clone));
tree basetype = TYPE_METHOD_BASETYPE (TREE_TYPE (clone));
tree type;
clone_parms);
if (exceptions)
type = build_exception_variant (type, exceptions);
+ if (attrs)
+ type = cp_build_type_attribute_variant (type, attrs);
TREE_TYPE (clone) = type;
clone_parms = NULL_TREE;
if (DECL_PURE_VIRTUAL_P (x))
VEC_safe_push (tree, gc, CLASSTYPE_PURE_VIRTUALS (t), x);
complete_vars (t);
+
+ /* Remember current #pragma pack value. */
+ TYPE_PRECISION (t) = maximum_field_alignment;
}
else
finish_struct_1 (t);
interoperability with most_specialized_instantiation. */
tree matches = NULL_TREE;
tree fn;
+ tree target_fn_type;
/* By the time we get here, we should be seeing only real
pointer-to-member types, not the internal POINTER_TYPE to
return error_mark_node;
}
+ /* Non-member functions and static member functions match targets of type
+ "pointer-to-function" or "reference-to-function." Nonstatic member
+ functions match targets of type "pointer-to-member-function;" the
+ function type of the pointer to member is used to select the member
+ function from the set of overloaded member functions.
+
+ So figure out the FUNCTION_TYPE that we want to match against. */
+ target_fn_type = static_fn_type (target_type);
+
/* If we can find a non-template function that matches, we can just
use it. There's no point in generating template instantiations
if we're just going to throw them out anyhow. But, of course, we
for (fns = overload; fns; fns = OVL_NEXT (fns))
{
tree fn = OVL_CURRENT (fns);
- tree fntype;
if (TREE_CODE (fn) == TEMPLATE_DECL)
/* We're not looking for templates just yet. */
continue;
/* See if there's a match. */
- fntype = TREE_TYPE (fn);
- if (is_ptrmem)
- fntype = build_ptrmemfunc_type (build_pointer_type (fntype));
- else if (!is_reference)
- fntype = build_pointer_type (fntype);
-
- if (can_convert_arg (target_type, fntype, fn, LOOKUP_NORMAL))
+ if (same_type_p (target_fn_type, static_fn_type (fn)))
matches = tree_cons (fn, NULL_TREE, matches);
}
}
match we need to look at them, too. */
if (!matches)
{
- tree target_fn_type;
tree target_arg_types;
tree target_ret_type;
tree fns;
unsigned int nargs, ia;
tree arg;
- if (is_ptrmem)
- target_fn_type
- = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (target_type));
- else
- target_fn_type = TREE_TYPE (target_type);
target_arg_types = TYPE_ARG_TYPES (target_fn_type);
target_ret_type = TREE_TYPE (target_fn_type);
- /* Never do unification on the 'this' parameter. */
- if (TREE_CODE (target_fn_type) == METHOD_TYPE)
- target_arg_types = TREE_CHAIN (target_arg_types);
-
nargs = list_length (target_arg_types);
args = XALLOCAVEC (tree, nargs);
for (arg = target_arg_types, ia = 0;
{
tree fn = OVL_CURRENT (fns);
tree instantiation;
- tree instantiation_type;
tree targs;
if (TREE_CODE (fn) != TEMPLATE_DECL)
continue;
/* See if there's a match. */
- instantiation_type = TREE_TYPE (instantiation);
- if (is_ptrmem)
- instantiation_type =
- build_ptrmemfunc_type (build_pointer_type (instantiation_type));
- else if (!is_reference)
- instantiation_type = build_pointer_type (instantiation_type);
- if (can_convert_arg (target_type, instantiation_type, instantiation,
- LOOKUP_NORMAL))
+ if (same_type_p (target_fn_type, static_fn_type (instantiation)))
matches = tree_cons (instantiation, fn, matches);
}