typeck.c (build_ptrmemfunc): Just reinterpret if there's no adjustment necessary.
* typeck.c (build_ptrmemfunc): Just reinterpret if there's no adjustment necessary. From-SVN: r35954
This commit is contained in:
parent
40e8cc959c
commit
3f2b640a7a
@ -1,3 +1,8 @@
|
||||
2000-08-24 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* typeck.c (build_ptrmemfunc): Just reinterpret if there's no
|
||||
adjustment necessary.
|
||||
|
||||
2000-08-24 Greg McGary <greg@mcgary.org>
|
||||
|
||||
* cp-tree.h (MAIN_NAME_P): Remove macro.
|
||||
|
@ -6125,12 +6125,21 @@ build_ptrmemfunc (type, pfn, force)
|
||||
cp_error ("invalid conversion to type `%T' from type `%T'",
|
||||
to_type, pfn_type);
|
||||
|
||||
n = get_delta_difference (TYPE_PTRMEMFUNC_OBJECT_TYPE (pfn_type),
|
||||
TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type),
|
||||
force);
|
||||
|
||||
/* We don't have to do any conversion to convert a
|
||||
pointer-to-member to its own type. But, we don't want to
|
||||
just return a PTRMEM_CST if there's an explicit cast; that
|
||||
cast should make the expression an invalid template argument. */
|
||||
if (TREE_CODE (pfn) != PTRMEM_CST && same_type_p (to_type, pfn_type))
|
||||
if (TREE_CODE (pfn) != PTRMEM_CST)
|
||||
{
|
||||
if (same_type_p (to_type, pfn_type))
|
||||
return pfn;
|
||||
else if (integer_zerop (n))
|
||||
return build_reinterpret_cast (to_type, pfn);
|
||||
}
|
||||
|
||||
if (TREE_SIDE_EFFECTS (pfn))
|
||||
pfn = save_expr (pfn);
|
||||
@ -6142,9 +6151,6 @@ build_ptrmemfunc (type, pfn, force)
|
||||
npfn = build_component_ref (pfn, pfn_identifier, NULL_TREE, 0);
|
||||
delta = build_component_ref (pfn, delta_identifier, NULL_TREE, 0);
|
||||
delta = cp_convert (ptrdiff_type_node, delta);
|
||||
n = get_delta_difference (TYPE_PTRMEMFUNC_OBJECT_TYPE (pfn_type),
|
||||
TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type),
|
||||
force);
|
||||
delta = cp_build_binary_op (PLUS_EXPR, delta, n);
|
||||
return build_ptrmemfunc1 (to_type, delta, NULL_TREE, npfn,
|
||||
NULL_TREE);
|
||||
@ -6173,9 +6179,6 @@ build_ptrmemfunc (type, pfn, force)
|
||||
idx = build_component_ref (pfn, index_identifier, NULL_TREE, 0);
|
||||
}
|
||||
|
||||
n = get_delta_difference (TYPE_PTRMEMFUNC_OBJECT_TYPE (pfn_type),
|
||||
TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type),
|
||||
force);
|
||||
delta = cp_build_binary_op (PLUS_EXPR, ndelta, n);
|
||||
delta2 = cp_build_binary_op (PLUS_EXPR, ndelta2, n);
|
||||
e1 = fold (build (GT_EXPR, boolean_type_node, idx, integer_zero_node));
|
||||
|
Loading…
Reference in New Issue
Block a user