if (type != TYPE_MAIN_VARIANT (type))
addr = cp_convert (build_pointer_type (TYPE_MAIN_VARIANT (type)), addr);
- fn = instantiate_type (fntype, fns, 0);
+ fn = instantiate_type (fntype, fns, 2);
if (fn != error_mark_node)
{
tree_cons (NULL_TREE, sizetype, void_list_node));
fntype = build_function_type (void_type_node, argtypes);
- fn = instantiate_type (fntype, fns, 0);
+ fn = instantiate_type (fntype, fns, 2);
if (fn != error_mark_node)
{
- if (TREE_CODE (fns) == TREE_LIST)
+ if (BASELINK_P (fns))
/* Member functions. */
enforce_access (TREE_PURPOSE (fns), fn);
return build_function_call
try many possible instantiations, in hopes that at least one will
work.
+ FLAGS is a bitmask, as we see at the top of the function.
+
For non-recursive calls, LHSTYPE should be a function, pointer to
function, or a pointer to member function. */
tree
-instantiate_type (lhstype, rhs, complain)
+instantiate_type (lhstype, rhs, flags)
tree lhstype, rhs;
- int complain;
+ int flags;
{
+ int complain = (flags & 1);
+ int strict = (flags & 2) ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT;
+
if (TREE_CODE (lhstype) == UNKNOWN_TYPE)
{
if (complain)
if (TREE_TYPE (rhs) != NULL_TREE && ! (type_unknown_p (rhs)))
{
- if (same_type_p (lhstype, TREE_TYPE (rhs)))
+ if (comptypes (lhstype, TREE_TYPE (rhs), strict))
return rhs;
if (complain)
cp_error ("argument of type `%T' does not match `%T'",
tree new_rhs;
new_rhs = instantiate_type (build_pointer_type (lhstype),
- TREE_OPERAND (rhs, 0), complain);
+ TREE_OPERAND (rhs, 0), flags);
if (new_rhs == error_mark_node)
return error_mark_node;
case NOP_EXPR:
rhs = copy_node (TREE_OPERAND (rhs, 0));
TREE_TYPE (rhs) = unknown_type_node;
- return instantiate_type (lhstype, rhs, complain);
+ return instantiate_type (lhstype, rhs, flags);
case COMPONENT_REF:
{
tree field = TREE_OPERAND (rhs, 1);
tree r;
- r = instantiate_type (lhstype, field, complain);
+ r = instantiate_type (lhstype, field, flags);
if (r != error_mark_node && TYPE_PTRMEMFUNC_P (lhstype))
{
/*explicit_targs=*/NULL_TREE);
case TREE_LIST:
- {
- if (TREE_PURPOSE (rhs) == error_mark_node)
- {
- /* Make sure we don't drop the non-local flag, as the old code
- would rely on it. */
- int nl = TREE_NONLOCAL_FLAG (rhs);
- /* We don't need the type of this node. */
- rhs = TREE_VALUE (rhs);
- my_friendly_assert (TREE_NONLOCAL_FLAG (rhs) == nl, 980331);
- }
+ /* Now we should have a baselink. */
+ my_friendly_assert (BASELINK_P (rhs), 990412);
- /* Now we should have a baselink. */
- my_friendly_assert (TREE_CODE (TREE_PURPOSE (rhs)) == TREE_VEC,
- 980331);
- my_friendly_assert (TREE_CHAIN (rhs) == NULL_TREE, 181);
- my_friendly_assert (TREE_CODE (TREE_VALUE (rhs)) == FUNCTION_DECL
- || TREE_CODE (TREE_VALUE (rhs)) == OVERLOAD,
- 182);
-
- return instantiate_type (lhstype, TREE_VALUE (rhs), complain);
- }
+ return instantiate_type (lhstype, TREE_VALUE (rhs), flags);
case CALL_EXPR:
/* This is too hard for now. */
case MINUS_EXPR:
case COMPOUND_EXPR:
TREE_OPERAND (rhs, 0)
- = instantiate_type (lhstype, TREE_OPERAND (rhs, 0), complain);
+ = instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags);
if (TREE_OPERAND (rhs, 0) == error_mark_node)
return error_mark_node;
TREE_OPERAND (rhs, 1)
- = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), complain);
+ = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags);
if (TREE_OPERAND (rhs, 1) == error_mark_node)
return error_mark_node;
return error_mark_node;
}
TREE_OPERAND (rhs, 1)
- = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), complain);
+ = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags);
if (TREE_OPERAND (rhs, 1) == error_mark_node)
return error_mark_node;
TREE_OPERAND (rhs, 2)
- = instantiate_type (lhstype, TREE_OPERAND (rhs, 2), complain);
+ = instantiate_type (lhstype, TREE_OPERAND (rhs, 2), flags);
if (TREE_OPERAND (rhs, 2) == error_mark_node)
return error_mark_node;
case MODIFY_EXPR:
TREE_OPERAND (rhs, 1)
- = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), complain);
+ = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags);
if (TREE_OPERAND (rhs, 1) == error_mark_node)
return error_mark_node;
return rhs;
case ADDR_EXPR:
- return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), complain);
+ return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags);
case ENTRY_VALUE_EXPR:
my_friendly_abort (184);