------- Additional Comments From gdr at gcc dot gnu dot org  2005-07-03 14:10 
-------
(In reply to comment #3)
> Subject: Re:  [4.0/4.1 regression] '#'obj_type_ref' not supported by dump_expr
> 
> "pinskia at gcc dot gnu dot org" <[EMAIL PROTECTED]> writes:
> 
> | ------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-30
02:00 -------
> | Confirmed, caused by the patch which introduced obj_type_ref.  This also
means we can produce better 
> | diagnostic.
> 
> indeed.  Assign it to me.
> 
> -- Gaby
> 


It's simple to move back to the awfull printing -- just add a case
for OBJ_TYPE_REF.
However, it is hard to fix this completely without, either
  (a) having the front-end stop generating low-level three nodes;
  (b) and/or moving to diagnostic with caret.

Adding the following to dump_expr():<case CALL_EXPR>

        if (TREE_CODE (fn) == OBJ_TYPE_REF)
          {
            tree obj_type = TREE_TYPE (OBJ_TYPE_REF_OBJECT (fn));
            int idx = tree_low_cst (OBJ_TYPE_REF_TOKEN (fn), 1);
            fn = BINFO_VIRTUALS (TYPE_BINFO (TREE_TYPE (obj_type)));
            while (idx--)
              fn = TREE_CHAIN (fn);
            fn = BV_FN (fn);
          }

yields

22238.C: In member function 'void A::bar()':
22238.C:4: error: could not convert 'A::foo()' to 'bool'

(while an improvement, it is still suboptimal).  Now, if you slightly
change the testcase to

struct A
{
   virtual void foo();
};

struct B : virtual A {
   void bar() { if (foo()) ; }
};


then you would get the awful

3.C: In member function 'void B::bar()':
3.C:7: error: could not convert '(((A*)this) +
(*(int*)(((B*)this)->B::<anonymous>.A::_vptr.A + -0x000000010)))->A::foo()' to
'bool'


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22238

Reply via email to