Re: sequence of inheritance from virtual base class?
On 5/15/13 6:42 AM, Ralf Fassel wrote:
* ?? Tiib <ootiib@hot.ee>
| On Tuesday, 14 May 2013 20:33:48 UTC+3, Ralf Fassel wrote:
| > d1.foo(); // ok
| > d2.foo(); // crashes in big app
| >
| The app you posted does not crash. You failed to make minimal
| example that demonstrates the issue. Keep on looking. Undefined
| behavior that crashes the app is in code that you did not post so
| we can not help you.
Just to confirm: you say the order of inheritance should NOT matter?
NB. I know that it does not crash, the code was meant to explain the
problem and a current work-around (which makes no sense IMHO).
valgrind does not show any problems up to the crash, and the
debugger ends up in a completely unrelated function when the crash
happens (no code path which leads to the function stack shown in gdb
in the core dump, single-threaded). If someone said "yes, the order
of inheritance DOES matter, cf. Standard x.y.z", I could stop
investigating further.
{ Quoted signature removed -mod/we }
The order of inheritance should not matter for conforming code. A
likely issue is code that assumes &Derived == &Base and does invalid
casting on it.
Small nit, you do NOT have a "virtual base class" here, that term
refers to using virtual inheritance (using the virtual keyword in the
list of base classes), not inheriting from a polymorphic class with
virtual functions.
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]