Hello again, folks!
So, I have a large C++ app, using PRC-tools, and it crashinates horribly
when I use Virtual Inheritance with any kind of optimization turned on.
So, the situation is something like:
class Super
{
Super()
{
HostTraceOutputTL(appErrorClass, "SUPER");
}
}
class Sub1 : virtual public Super {
Sub1()
{
HostTraceOutputTL(appErrorClass, "SUB1");
}
}
class Sub2 : public Sub1 {
Sub2()
{
HostTraceOutputTL(appErrorClass, "SUB2");
}
}
main()
{
HostTraceOutputTL(appErrorClass, "START");
Super *s = new Sub2();
}
So this code would produce:
START
SUPER
SUB1
Invalid read/write from random memory address.
With NO optimizations, it all works as expected. with -O -O1 -O2 -Os it
makes all crashings.
Note that the same thing also occurs if I do:
Super *s = new Sub1();
instead.
Is there any compiler feature I can specify that will let me use
optimizations and virtual inheritance? If not I have to redesign some
stuff that I don't particularly want to. Or is this totally whacked and
is clearly some badness that I am doing?
Thanks again for any help!
-DG
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/