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

             Bug #: 50817
           Summary: G++ emits errors containing lowered vtable references
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: m...@gcc.gnu.org


struct a {
    virtual int bar();
  };

  struct foo : public virtual a {
  };

  void test(foo *P) {
    return P->bar() + *P;
  }

g++ revision 180166: 

 void test(foo*)
vtable.cc:9:22: error: no match for ‘operator+’ in ‘(((a*)P) +
((sizetype)(*(long int*)(P->foo::<anonymous>.a::_vptr.a +
0xffffffffffffffffffffffffffffffe0u))))->a::bar() + * P’
vtable.cc:9:22: error: return-statement with a value, in function returning
'void' [-fpermissive]

clang:

 t.cc:9:18: error: invalid operands to binary expression ('int' and 'foo')
    return P->bar() + *P;
           ~~~~~~~~ ^ ~~

Reply via email to