[haiku-development] Re: Help needed with the unit testing framework

  • From: pulkomandy <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 28 Jul 2014 12:54:03 +0200

On Mon, Jul 28, 2014 at 11:46:56AM +0200, Stephan Aßmus wrote:
> Hi,
> 
> Am 28.07.2014 10:04, schrieb pulkomandy:
> >The methods are virtual, and the signature of the override is the
> >matching. They both have protected visibility, which should be fine. So
> >I don't understand why the overriden methods are never called. Do you
> >have an idea what the problem is? I probably missed something obvious
> >but I can't see the issue...
> 
> where are the methods being called from? From within the constructor of
> BTestShell? If yes, I think it could be the problem: At that moment, the
> constructor of UnitTesterShell has not completed, and the object is not
> (yet) considered of type UnitTesterShell. Don't know if I explained it in
> the right terms.

I thought of that too, but they are called from the Run method after the
object is constructed (and before it is deleted). Calling the methods
directly from main before the call to Run works, so the object is
properly initialized.

Knowing that this only happens with gcc2, I think it somehow misses the fact
that the method is virtual when compiling the base class, and generates a
direct call instead of a virtual one (going through the vtable). I'll
see if I can write the code in a different way to work around the
problem, then.

-- 
Adrien.

Other related posts: