implicitly-defined virtual destructors

Jessica Han jessica at cup.hp.com
Fri Aug 2 00:14:03 UTC 2002


For test case test.C
class base_class
{
 public:
 virtual ~base_class(){};
};

class derived_class :public base_class{
public:
 virtual void foo(){};
};

int main(){
 derived_class B;
 base_class A;
}
ABI says "If a class has an implicitly-defined virtual destructor, its
entries come after the declared virtual function pointers. " Thus in vtable
of derived_class, function descriptor of the implicitly-defined virtual
destructors derived_class::~derived_class should come after
derived_class::foo().
But gcc generates the following vtable for derived_class:
vtable for derived_class:
        data4   0
        data4   0
        data4   typeinfo for derived_class#
        data4   0
        data8.ua @iplt(derived_class::~derived_class [in-charge]()#)
        data8.ua 0
        data8.ua @iplt(derived_class::~derived_class [in-charge
deleting]()#)
        data8.ua 0
        data8.ua @iplt(derived_class::foo()#)
        data8.ua 0

Does this violate the ABI? If this is not a test case for implicitly-defined
virtual destructors, could you please tell me how should I modify my test
case? Thanks.

----
Jessica Han
Open Source Tools
Hewlett-Packard
(408) 447-6154




More information about the cxx-abi-dev mailing list