re PR c++/9868 (ICE in c_expand_expr when qualifying member variable)
authorJason Merrill <jason@redhat.com>
Mon, 10 Mar 2003 21:10:37 +0000 (16:10 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 10 Mar 2003 21:10:37 +0000 (16:10 -0500)
        PR c++/9868
        * call.c (resolve_scoped_fn_name): Handle the case of a function
        pointer member.

From-SVN: r64122

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/decl2.c

index 72dcb9dc3a6305422ea44f64eb59a05e4f5d5c70..403747113f40fb49a743302c10a8bfac1990cfcb 100644 (file)
@@ -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
index 64da5a43b993f0790795197532c48ce584b3d4fd..460976265e77ca343bad931553b747bd5722ca99 100644 (file)
@@ -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)
index f85fef2fa4e0ca49cfadd286620181ffcd6e6de0..1920c6558e4ce2b4d56fe97b6911dea58cab5203 100644 (file)
@@ -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);
 }