Commit 7f58e7ac by Gabriel Dos Reis Committed by Gabriel Dos Reis

re PR c++/22238 (Awful error messages with virtual functions)

        PR c++/22238
        * error.c (resolve_virtual_fun_from_obj_type_ref): New.
        (dump_expr): Use it in <case CALL_EXPR>.

From-SVN: r107366
parent d5e07b79
2005-11-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
PR c++/22238
* error.c (resolve_virtual_fun_from_obj_type_ref): New.
(dump_expr): Use it in <case CALL_EXPR>.
2005-11-21 Richard Henderson <rth@redhat.com>
* cp-objcp-common.h, name-lookup.c, name-lookup.h: Revert 11-18 patch.
......
......@@ -1278,6 +1278,23 @@ dump_expr_init_vec (VEC(constructor_elt,gc) *v, int flags)
}
/* We've gotten an indirect REFERENCE (an OBJ_TYPE_REF) to a virtual
function. Resolve it to a close relative -- in the sense of static
type -- variant being overridden. That is close to what was written in
the source code. Subroutine of dump_expr. */
static tree
resolve_virtual_fun_from_obj_type_ref (tree ref)
{
tree obj_type = TREE_TYPE (OBJ_TYPE_REF_OBJECT (ref));
int index = tree_low_cst (OBJ_TYPE_REF_TOKEN (ref), 1);
tree fun = BINFO_VIRTUALS (TYPE_BINFO (TREE_TYPE (obj_type)));
while (index--)
fun = TREE_CHAIN (fun);
return BV_FN (fun);
}
/* Print out an expression E under control of FLAGS. */
static void
......@@ -1386,6 +1403,10 @@ dump_expr (tree t, int flags)
if (TREE_CODE (fn) == ADDR_EXPR)
fn = TREE_OPERAND (fn, 0);
/* Nobody is interested in seeing the guts of vcalls. */
if (TREE_CODE (fn) == OBJ_TYPE_REF)
fn = resolve_virtual_fun_from_obj_type_ref (fn);
if (TREE_TYPE (fn) != NULL_TREE && NEXT_CODE (fn) == METHOD_TYPE)
{
tree ob = TREE_VALUE (args);
......
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