bug-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

virtual table off by three problem


From: Aubrey Holland
Subject: virtual table off by three problem
Date: 10 Feb 2002 11:16:59 -0800

In one of my libraries, I have a rather deep inheritance tree where
the classes in this tree contain quite a few virtual functions.  I
have noticed recently that there seems to be a problem with the
virtual tables that get created for some of these classes. 
Specifically, when I try to call one of the virtual methods in this
class, the result is that I get a call to the virtual method that is
three virtual methods down in the header file.  I.e. in the following
overly-simplified example, a call to a() would result in d() actually
being called.  This happens regardless of where I place the function
in the header file... the third one down is always called.

class example
{
    virtual void a();

    void nonvirtual();

    virtual void b();
    virtual void c();
    virtual void d();
};

I saw the following previous similar posting, but it seems to indicate
the the bug is already fixed:

http://groups.google.com/groups?q=g%2B%2B+virtual+table+off+by&hl=en&selm=Pine.OSF.3.91j.950911160602.5228N-100000%40saul6.u.washington.edu&rnum=3

I'm working on trying to reproduce this in a smaller, more portable
example program but haven't had much luck as of yet.

Sysyem info:

Dual processor Dell Workstation, running Pentium Xeon processors.
RedHat 7.2
gcc and g++ 2.96-98

TIA,
Aubrey Holland



reply via email to

[Prev in Thread] Current Thread [Next in Thread]