Commit 7866705a by Steven Bosscher

typeck.c (comptypes): First determine if the types are compatible from a…

typeck.c (comptypes): First determine if the types are compatible from a target-independent point of view.

	* typeck.c (comptypes): First determine if the types are compatible
	from a target-independent point of view.  Check target attributes
	last.

	* class.c (build_base_path):
	(build_vbase_offset_vtbl_entries):
	(add_vcall_offset): Replace fold (buildN (...)) with fold_buildN.
	* error.c (dump_expr): Likewise.
	* init.c (build_zero_init, expand_cleanup_for_base,
	build_vec_delete_1): Likewise.
	* mangle.c (write_integer_cst): Likewise.
	* method.c (thunk_adjust): Likewise.
	* pt.c (convert_nontype_argument, tsubst, unify): Likewise.
	* tree.c (cxx_print_statistics, array_type_nelts_total): Likewise.
	* typeck.c (build_ptrmemfunc_access_expr,
	(get_member_function_from_ptrfunc): Likewise.

From-SVN: r96985
parent 29ae3843
2005-03-24 Steven Bosscher <stevenb@suse.de>
* typeck.c (comptypes): First determine if the types are compatible
from a target-independent point of view. Check target attributes
last.
* class.c (build_base_path):
(build_vbase_offset_vtbl_entries):
(add_vcall_offset): Replace fold (buildN (...)) with fold_buildN.
* error.c (dump_expr): Likewise.
* init.c (build_zero_init, expand_cleanup_for_base,
build_vec_delete_1): Likewise.
* mangle.c (write_integer_cst): Likewise.
* method.c (thunk_adjust): Likewise.
* pt.c (convert_nontype_argument, tsubst, unify): Likewise.
* tree.c (cxx_print_statistics, array_type_nelts_total): Likewise.
* typeck.c (build_ptrmemfunc_access_expr,
(get_member_function_from_ptrfunc): Likewise.
2005-03-23 Joseph S. Myers <joseph@codesourcery.com> 2005-03-23 Joseph S. Myers <joseph@codesourcery.com>
* cp-objcp-common.h (LANG_HOOKS_TRUTHVALUE_CONVERSION): Remove. * cp-objcp-common.h (LANG_HOOKS_TRUTHVALUE_CONVERSION): Remove.
...@@ -290,7 +309,7 @@ ...@@ -290,7 +309,7 @@
Add qualifiers when declaring a typedef of a function type. Add qualifiers when declaring a typedef of a function type.
Member function pointers pick up the qualifiers of the typedef Member function pointers pick up the qualifiers of the typedef
used to declare them. used to declare them.
Don't complain about creating cv-qualified function types. Don't complain about creating cv-qualified function types.
Complain about qualified function typedefs that are used to Complain about qualified function typedefs that are used to
declare non-static member functions or free functions. declare non-static member functions or free functions.
Use cp_apply_type_quals_to_decl. Use cp_apply_type_quals_to_decl.
......
...@@ -296,8 +296,8 @@ build_base_path (enum tree_code code, ...@@ -296,8 +296,8 @@ build_base_path (enum tree_code code,
if (null_test) if (null_test)
{ {
tree zero = cp_convert (TREE_TYPE (expr), integer_zero_node); tree zero = cp_convert (TREE_TYPE (expr), integer_zero_node);
null_test = fold (build2 (NE_EXPR, boolean_type_node, null_test = fold_build2 (NE_EXPR, boolean_type_node,
expr, zero)); expr, zero);
} }
/* If this is a simple base reference, express it as a COMPONENT_REF. */ /* If this is a simple base reference, express it as a COMPONENT_REF. */
...@@ -388,9 +388,9 @@ build_base_path (enum tree_code code, ...@@ -388,9 +388,9 @@ build_base_path (enum tree_code code,
out: out:
if (null_test) if (null_test)
expr = fold (build3 (COND_EXPR, target_type, null_test, expr, expr = fold_build3 (COND_EXPR, target_type, null_test, expr,
fold (build1 (NOP_EXPR, target_type, fold_build1 (NOP_EXPR, target_type,
integer_zero_node)))); integer_zero_node));
return expr; return expr;
} }
...@@ -7406,9 +7406,9 @@ build_vbase_offset_vtbl_entries (tree binfo, vtbl_init_data* vid) ...@@ -7406,9 +7406,9 @@ build_vbase_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
*vid->last_init *vid->last_init
= build_tree_list (NULL_TREE, = build_tree_list (NULL_TREE,
fold (build1 (NOP_EXPR, fold_build1 (NOP_EXPR,
vtable_entry_type, vtable_entry_type,
delta))); delta));
vid->last_init = &TREE_CHAIN (*vid->last_init); vid->last_init = &TREE_CHAIN (*vid->last_init);
} }
} }
...@@ -7633,8 +7633,8 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid) ...@@ -7633,8 +7633,8 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
BINFO_OFFSET from vid->binfo. */ BINFO_OFFSET from vid->binfo. */
vcall_offset = size_diffop (BINFO_OFFSET (base), vcall_offset = size_diffop (BINFO_OFFSET (base),
BINFO_OFFSET (vid->binfo)); BINFO_OFFSET (vid->binfo));
vcall_offset = fold (build1 (NOP_EXPR, vtable_entry_type, vcall_offset = fold_build1 (NOP_EXPR, vtable_entry_type,
vcall_offset)); vcall_offset);
} }
/* Add the initializer to the vtable. */ /* Add the initializer to the vtable. */
*vid->last_init = build_tree_list (NULL_TREE, vcall_offset); *vid->last_init = build_tree_list (NULL_TREE, vcall_offset);
......
...@@ -1413,9 +1413,9 @@ dump_expr (tree t, int flags) ...@@ -1413,9 +1413,9 @@ dump_expr (tree t, int flags)
if (TREE_CODE (type) == ARRAY_REF) if (TREE_CODE (type) == ARRAY_REF)
type = build_cplus_array_type type = build_cplus_array_type
(TREE_OPERAND (type, 0), (TREE_OPERAND (type, 0),
build_index_type (fold (build2 (MINUS_EXPR, integer_type_node, build_index_type (fold_build2 (MINUS_EXPR, integer_type_node,
TREE_OPERAND (type, 1), TREE_OPERAND (type, 1),
integer_one_node)))); integer_one_node)));
dump_type (type, flags); dump_type (type, flags);
if (init) if (init)
{ {
......
...@@ -222,8 +222,8 @@ build_zero_init (tree type, tree nelts, bool static_storage_p) ...@@ -222,8 +222,8 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
/* Iterate over the array elements, building initializations. */ /* Iterate over the array elements, building initializations. */
inits = NULL_TREE; inits = NULL_TREE;
if (nelts) if (nelts)
max_index = fold (build2 (MINUS_EXPR, TREE_TYPE (nelts), max_index = fold_build2 (MINUS_EXPR, TREE_TYPE (nelts),
nelts, integer_one_node)); nelts, integer_one_node);
else else
max_index = array_type_nelts (type); max_index = array_type_nelts (type);
gcc_assert (TREE_CODE (max_index) == INTEGER_CST); gcc_assert (TREE_CODE (max_index) == INTEGER_CST);
...@@ -826,9 +826,9 @@ expand_cleanup_for_base (tree binfo, tree flag) ...@@ -826,9 +826,9 @@ expand_cleanup_for_base (tree binfo, tree flag)
binfo, binfo,
LOOKUP_NORMAL | LOOKUP_NONVIRTUAL); LOOKUP_NORMAL | LOOKUP_NONVIRTUAL);
if (flag) if (flag)
expr = fold (build3 (COND_EXPR, void_type_node, expr = fold_build3 (COND_EXPR, void_type_node,
c_common_truthvalue_conversion (flag), c_common_truthvalue_conversion (flag),
expr, integer_zero_node)); expr, integer_zero_node);
finish_eh_cleanup (expr); finish_eh_cleanup (expr);
} }
...@@ -2241,9 +2241,9 @@ build_vec_delete_1 (tree base, tree maxindex, tree type, ...@@ -2241,9 +2241,9 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
tbase = create_temporary_var (ptype); tbase = create_temporary_var (ptype);
tbase_init = build_modify_expr (tbase, NOP_EXPR, tbase_init = build_modify_expr (tbase, NOP_EXPR,
fold (build2 (PLUS_EXPR, ptype, fold_build2 (PLUS_EXPR, ptype,
base, base,
virtual_size))); virtual_size));
DECL_REGISTER (tbase) = 1; DECL_REGISTER (tbase) = 1;
controller = build3 (BIND_EXPR, void_type_node, tbase, controller = build3 (BIND_EXPR, void_type_node, tbase,
NULL_TREE, NULL_TREE); NULL_TREE, NULL_TREE);
...@@ -2308,11 +2308,11 @@ build_vec_delete_1 (tree base, tree maxindex, tree type, ...@@ -2308,11 +2308,11 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
body = integer_zero_node; body = integer_zero_node;
/* Outermost wrapper: If pointer is null, punt. */ /* Outermost wrapper: If pointer is null, punt. */
body = fold (build3 (COND_EXPR, void_type_node, body = fold_build3 (COND_EXPR, void_type_node,
fold (build2 (NE_EXPR, boolean_type_node, base, fold_build2 (NE_EXPR, boolean_type_node, base,
convert (TREE_TYPE (base), convert (TREE_TYPE (base),
integer_zero_node))), integer_zero_node)),
body, integer_zero_node)); body, integer_zero_node);
body = build1 (NOP_EXPR, void_type_node, body); body = build1 (NOP_EXPR, void_type_node, body);
if (controller) if (controller)
......
...@@ -1249,16 +1249,16 @@ write_integer_cst (const tree cst) ...@@ -1249,16 +1249,16 @@ write_integer_cst (const tree cst)
if (sign < 0) if (sign < 0)
{ {
write_char ('n'); write_char ('n');
n = fold (build1 (NEGATE_EXPR, type, n)); n = fold_build1 (NEGATE_EXPR, type, n);
} }
do do
{ {
tree d = fold (build2 (FLOOR_DIV_EXPR, type, n, base)); tree d = fold_build2 (FLOOR_DIV_EXPR, type, n, base);
tree tmp = fold (build2 (MULT_EXPR, type, d, base)); tree tmp = fold_build2 (MULT_EXPR, type, d, base);
unsigned c; unsigned c;
done = integer_zerop (d); done = integer_zerop (d);
tmp = fold (build2 (MINUS_EXPR, type, n, tmp)); tmp = fold_build2 (MINUS_EXPR, type, n, tmp);
c = hwint_to_ascii (TREE_INT_CST_LOW (tmp), 10, ptr, c = hwint_to_ascii (TREE_INT_CST_LOW (tmp), 10, ptr,
done ? 1 : chunk_digits); done ? 1 : chunk_digits);
ptr -= c; ptr -= c;
......
...@@ -220,8 +220,8 @@ thunk_adjust (tree ptr, bool this_adjusting, ...@@ -220,8 +220,8 @@ thunk_adjust (tree ptr, bool this_adjusting,
{ {
if (this_adjusting) if (this_adjusting)
/* Adjust the pointer by the constant. */ /* Adjust the pointer by the constant. */
ptr = fold (build2 (PLUS_EXPR, TREE_TYPE (ptr), ptr, ptr = fold_build2 (PLUS_EXPR, TREE_TYPE (ptr), ptr,
ssize_int (fixed_offset))); ssize_int (fixed_offset));
/* If there's a virtual offset, look up that value in the vtable and /* If there's a virtual offset, look up that value in the vtable and
adjust the pointer again. */ adjust the pointer again. */
...@@ -242,13 +242,13 @@ thunk_adjust (tree ptr, bool this_adjusting, ...@@ -242,13 +242,13 @@ thunk_adjust (tree ptr, bool this_adjusting,
/* Get the offset itself. */ /* Get the offset itself. */
vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable); vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable);
/* Adjust the `this' pointer. */ /* Adjust the `this' pointer. */
ptr = fold (build2 (PLUS_EXPR, TREE_TYPE (ptr), ptr, vtable)); ptr = fold_build2 (PLUS_EXPR, TREE_TYPE (ptr), ptr, vtable);
} }
if (!this_adjusting) if (!this_adjusting)
/* Adjust the pointer by the constant. */ /* Adjust the pointer by the constant. */
ptr = fold (build2 (PLUS_EXPR, TREE_TYPE (ptr), ptr, ptr = fold_build2 (PLUS_EXPR, TREE_TYPE (ptr), ptr,
ssize_int (fixed_offset))); ssize_int (fixed_offset));
return ptr; return ptr;
} }
......
...@@ -3612,7 +3612,7 @@ convert_nontype_argument (tree type, tree expr) ...@@ -3612,7 +3612,7 @@ convert_nontype_argument (tree type, tree expr)
if (!expr || expr == error_mark_node) if (!expr || expr == error_mark_node)
return expr; return expr;
expr = build_nop(type, build_address (expr)); expr = build_nop (type, build_address (expr));
} }
/* [temp.arg.nontype]/5, bullet 6 /* [temp.arg.nontype]/5, bullet 6
...@@ -7342,7 +7342,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -7342,7 +7342,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (e1 == error_mark_node || e2 == error_mark_node) if (e1 == error_mark_node || e2 == error_mark_node)
return error_mark_node; return error_mark_node;
return fold (build2 (TREE_CODE (t), TREE_TYPE (t), e1, e2)); return fold_build2 (TREE_CODE (t), TREE_TYPE (t), e1, e2);
} }
case NEGATE_EXPR: case NEGATE_EXPR:
...@@ -7352,7 +7352,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -7352,7 +7352,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (e == error_mark_node) if (e == error_mark_node)
return error_mark_node; return error_mark_node;
return fold (build1 (TREE_CODE (t), TREE_TYPE (t), e)); return fold_build1 (TREE_CODE (t), TREE_TYPE (t), e);
} }
case TYPENAME_TYPE: case TYPENAME_TYPE:
...@@ -10158,10 +10158,10 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict) ...@@ -10158,10 +10158,10 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict)
not an integer constant. */ not an integer constant. */
if (TREE_CODE (parm_max) == MINUS_EXPR) if (TREE_CODE (parm_max) == MINUS_EXPR)
{ {
arg_max = fold (build2 (PLUS_EXPR, arg_max = fold_build2 (PLUS_EXPR,
integer_type_node, integer_type_node,
arg_max, arg_max,
TREE_OPERAND (parm_max, 1))); TREE_OPERAND (parm_max, 1));
parm_max = TREE_OPERAND (parm_max, 0); parm_max = TREE_OPERAND (parm_max, 0);
} }
......
...@@ -1112,9 +1112,9 @@ cxx_print_statistics (void) ...@@ -1112,9 +1112,9 @@ cxx_print_statistics (void)
tree tree
array_type_nelts_top (tree type) array_type_nelts_top (tree type)
{ {
return fold (build2 (PLUS_EXPR, sizetype, return fold_build2 (PLUS_EXPR, sizetype,
array_type_nelts (type), array_type_nelts (type),
integer_one_node)); integer_one_node);
} }
/* Return, as an INTEGER_CST node, the number of elements for TYPE /* Return, as an INTEGER_CST node, the number of elements for TYPE
...@@ -1129,7 +1129,7 @@ array_type_nelts_total (tree type) ...@@ -1129,7 +1129,7 @@ array_type_nelts_total (tree type)
while (TREE_CODE (type) == ARRAY_TYPE) while (TREE_CODE (type) == ARRAY_TYPE)
{ {
tree n = array_type_nelts_top (type); tree n = array_type_nelts_top (type);
sz = fold (build2 (MULT_EXPR, sizetype, sz, n)); sz = fold_build2 (MULT_EXPR, sizetype, sz, n);
type = TREE_TYPE (type); type = TREE_TYPE (type);
} }
return sz; return sz;
......
...@@ -905,8 +905,6 @@ comp_array_types (tree t1, tree t2, bool allow_redeclaration) ...@@ -905,8 +905,6 @@ comp_array_types (tree t1, tree t2, bool allow_redeclaration)
bool bool
comptypes (tree t1, tree t2, int strict) comptypes (tree t1, tree t2, int strict)
{ {
int retval;
if (t1 == t2) if (t1 == t2)
return true; return true;
...@@ -969,9 +967,7 @@ comptypes (tree t1, tree t2, int strict) ...@@ -969,9 +967,7 @@ comptypes (tree t1, tree t2, int strict)
&& TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2)) && TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
return true; return true;
if (!(*targetm.comp_type_attributes) (t1, t2)) /* Compare the types. Break out if they could be the same. */
return false;
switch (TREE_CODE (t1)) switch (TREE_CODE (t1))
{ {
case TEMPLATE_TEMPLATE_PARM: case TEMPLATE_TEMPLATE_PARM:
...@@ -984,7 +980,7 @@ comptypes (tree t1, tree t2, int strict) ...@@ -984,7 +980,7 @@ comptypes (tree t1, tree t2, int strict)
DECL_TEMPLATE_PARMS (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t2)))) DECL_TEMPLATE_PARMS (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t2))))
return false; return false;
if (TREE_CODE (t1) == TEMPLATE_TEMPLATE_PARM) if (TREE_CODE (t1) == TEMPLATE_TEMPLATE_PARM)
return true; break;
/* Don't check inheritance. */ /* Don't check inheritance. */
strict = COMPARE_STRICT; strict = COMPARE_STRICT;
/* Fall through. */ /* Fall through. */
...@@ -995,18 +991,17 @@ comptypes (tree t1, tree t2, int strict) ...@@ -995,18 +991,17 @@ comptypes (tree t1, tree t2, int strict)
&& (TYPE_TI_TEMPLATE (t1) == TYPE_TI_TEMPLATE (t2) && (TYPE_TI_TEMPLATE (t1) == TYPE_TI_TEMPLATE (t2)
|| TREE_CODE (t1) == BOUND_TEMPLATE_TEMPLATE_PARM) || TREE_CODE (t1) == BOUND_TEMPLATE_TEMPLATE_PARM)
&& comp_template_args (TYPE_TI_ARGS (t1), TYPE_TI_ARGS (t2))) && comp_template_args (TYPE_TI_ARGS (t1), TYPE_TI_ARGS (t2)))
return true; break;
if ((strict & COMPARE_BASE) && DERIVED_FROM_P (t1, t2)) if ((strict & COMPARE_BASE) && DERIVED_FROM_P (t1, t2))
return true; break;
else if ((strict & COMPARE_DERIVED) && DERIVED_FROM_P (t2, t1)) else if ((strict & COMPARE_DERIVED) && DERIVED_FROM_P (t2, t1))
return true; break;
/* We may be dealing with Objective-C instances... */ /* We may be dealing with Objective-C instances. */
if (TREE_CODE (t1) == RECORD_TYPE if (TREE_CODE (t1) == RECORD_TYPE
&& ((retval = objc_comptypes (t1, t2, 0)) >= 0)) && objc_comptypes (t1, t2, 0) > 0)
return retval; break;
/* ...but fall through if we are not. */
return false; return false;
...@@ -1014,51 +1009,72 @@ comptypes (tree t1, tree t2, int strict) ...@@ -1014,51 +1009,72 @@ comptypes (tree t1, tree t2, int strict)
if (!comptypes (TYPE_OFFSET_BASETYPE (t1), TYPE_OFFSET_BASETYPE (t2), if (!comptypes (TYPE_OFFSET_BASETYPE (t1), TYPE_OFFSET_BASETYPE (t2),
strict & ~COMPARE_REDECLARATION)) strict & ~COMPARE_REDECLARATION))
return false; return false;
return same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)); if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)))
return false;
break;
case POINTER_TYPE: case POINTER_TYPE:
case REFERENCE_TYPE: case REFERENCE_TYPE:
return TYPE_MODE (t1) == TYPE_MODE (t2) if (TYPE_MODE (t1) != TYPE_MODE (t2)
&& TYPE_REF_CAN_ALIAS_ALL (t1) == TYPE_REF_CAN_ALIAS_ALL (t2) || TYPE_REF_CAN_ALIAS_ALL (t1) != TYPE_REF_CAN_ALIAS_ALL (t2)
&& same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)); || !same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)))
return false;
break;
case METHOD_TYPE: case METHOD_TYPE:
case FUNCTION_TYPE: case FUNCTION_TYPE:
if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))) if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)))
return false; return false;
return compparms (TYPE_ARG_TYPES (t1), TYPE_ARG_TYPES (t2)); if (!compparms (TYPE_ARG_TYPES (t1), TYPE_ARG_TYPES (t2)))
return false;
break;
case ARRAY_TYPE: case ARRAY_TYPE:
/* Target types must match incl. qualifiers. */ /* Target types must match incl. qualifiers. */
return comp_array_types (t1, t2, !!(strict & COMPARE_REDECLARATION)); if (!comp_array_types (t1, t2, !!(strict & COMPARE_REDECLARATION)))
return false;
break;
case TEMPLATE_TYPE_PARM: case TEMPLATE_TYPE_PARM:
return (TEMPLATE_TYPE_IDX (t1) == TEMPLATE_TYPE_IDX (t2) if (TEMPLATE_TYPE_IDX (t1) != TEMPLATE_TYPE_IDX (t2)
&& TEMPLATE_TYPE_LEVEL (t1) == TEMPLATE_TYPE_LEVEL (t2)); || TEMPLATE_TYPE_LEVEL (t1) != TEMPLATE_TYPE_LEVEL (t2))
return false;
break;
case TYPENAME_TYPE: case TYPENAME_TYPE:
if (!cp_tree_equal (TYPENAME_TYPE_FULLNAME (t1), if (!cp_tree_equal (TYPENAME_TYPE_FULLNAME (t1),
TYPENAME_TYPE_FULLNAME (t2))) TYPENAME_TYPE_FULLNAME (t2)))
return false; return false;
return same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2)); if (!same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2)))
return false;
break;
case UNBOUND_CLASS_TEMPLATE: case UNBOUND_CLASS_TEMPLATE:
if (!cp_tree_equal (TYPE_IDENTIFIER (t1), TYPE_IDENTIFIER (t2))) if (!cp_tree_equal (TYPE_IDENTIFIER (t1), TYPE_IDENTIFIER (t2)))
return false; return false;
return same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2)); if (!same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2)))
return false;
break;
case COMPLEX_TYPE: case COMPLEX_TYPE:
return same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)); if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)))
return false;
break;
case VECTOR_TYPE: case VECTOR_TYPE:
return TYPE_VECTOR_SUBPARTS (t1) == TYPE_VECTOR_SUBPARTS (t2) if (TYPE_VECTOR_SUBPARTS (t1) != TYPE_VECTOR_SUBPARTS (t2)
&& same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)); || !same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)))
return false;
break; break;
default: default:
break; return false;
} }
return false;
/* If we get here, we know that from a target independent POV the
types are the same. Make sure the target attributes are also
the same. */
return targetm.comp_type_attributes (t1, t2);
} }
/* Returns 1 if TYPE1 is at least as qualified as TYPE2. */ /* Returns 1 if TYPE1 is at least as qualified as TYPE2. */
...@@ -1995,8 +2011,8 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name) ...@@ -1995,8 +2011,8 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name)
/*want_type=*/false); /*want_type=*/false);
member_type = cp_build_qualified_type (TREE_TYPE (member), member_type = cp_build_qualified_type (TREE_TYPE (member),
cp_type_quals (ptrmem_type)); cp_type_quals (ptrmem_type));
return fold (build3 (COMPONENT_REF, member_type, return fold_build3 (COMPONENT_REF, member_type,
ptrmem, member, NULL_TREE)); ptrmem, member, NULL_TREE);
} }
/* Given an expression PTR for a pointer, return an expression /* Given an expression PTR for a pointer, return an expression
...@@ -2343,7 +2359,7 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function) ...@@ -2343,7 +2359,7 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function)
vtbl = build_indirect_ref (vtbl, NULL); vtbl = build_indirect_ref (vtbl, NULL);
/* Finally, extract the function pointer from the vtable. */ /* Finally, extract the function pointer from the vtable. */
e2 = fold (build2 (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, idx)); e2 = fold_build2 (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, idx);
e2 = build_indirect_ref (e2, NULL); e2 = build_indirect_ref (e2, NULL);
TREE_CONSTANT (e2) = 1; TREE_CONSTANT (e2) = 1;
TREE_INVARIANT (e2) = 1; TREE_INVARIANT (e2) = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment