aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2003-03-10 16:10:37 -0500
committerJason Merrill <jason@gcc.gnu.org>2003-03-10 16:10:37 -0500
commit6e9554e198609e3787e53020ae29d6b99a9dfa7a (patch)
tree0279483ffb08f731bcb57108d2c320e7ae1507c9 /gcc/cp
parentebb780f29653177f3913296b6965058dc7b420bb (diff)
downloadgcc-6e9554e198609e3787e53020ae29d6b99a9dfa7a.zip
gcc-6e9554e198609e3787e53020ae29d6b99a9dfa7a.tar.gz
gcc-6e9554e198609e3787e53020ae29d6b99a9dfa7a.tar.bz2
re PR c++/9868 (ICE in c_expand_expr when qualifying member variable)
PR c++/9868 * call.c (resolve_scoped_fn_name): Handle the case of a function pointer member. From-SVN: r64122
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/call.c4
-rw-r--r--gcc/cp/decl2.c7
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);
}