diff options
| -rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
| -rw-r--r-- | gcc/cp/call.c | 4 | ||||
| -rw-r--r-- | gcc/cp/decl2.c | 7 |
3 files changed, 17 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 72dcb9d..4037471 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2003-03-10 Jason Merrill <jason@redhat.com> + + PR c++/9868 + * call.c (resolve_scoped_fn_name): Handle the case of a function + pointer member. + + * decl2.c (build_offset_ref_call_from_tree): Only mess with 'this' + argument in the pointer-to-member case. + 2003-03-09 Mark Mitchell <mark@codesourcery.com> PR c++/9373 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 64da5a4..4609762 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2702,6 +2702,10 @@ resolve_scoped_fn_name (tree scope, tree name) if (fn && current_class_type) fn = (adjust_result_of_qualified_name_lookup (fn, scope, current_class_type)); + + /* It might be the name of a function pointer member. */ + if (fn && TREE_CODE (fn) == FIELD_DECL) + fn = resolve_offset_ref (build_offset_ref (scope, fn)); } if (!fn) diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index f85fef2..1920c65 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3277,15 +3277,16 @@ build_offset_ref_call_from_tree (tree fn, tree args) /* This code is not really correct (for example, it does not handle the case that `A::f' is overloaded), but it is historically how we have handled this situation. */ - object_addr = build_unary_op (ADDR_EXPR, TREE_OPERAND (fn, 0), 0); if (TREE_CODE (TREE_OPERAND (fn, 1)) == FIELD_DECL) - fn = resolve_offset_ref (fn); + /* This case should now be handled elsewhere. */ + abort (); else { + object_addr = build_unary_op (ADDR_EXPR, TREE_OPERAND (fn, 0), 0); fn = TREE_OPERAND (fn, 1); fn = get_member_function_from_ptrfunc (&object_addr, fn); + args = tree_cons (NULL_TREE, object_addr, args); } - args = tree_cons (NULL_TREE, object_addr, args); return build_function_call (fn, args); } |
