Failure to build the method override tables results in expression failures on the following trivial test case:
class Base { public: virtual ~Base() {} virtual void foo() {} }; class Derived : public Base { public: virtual void foo() {} }; int main() { Derived d; Base *b = &d; return 0; // "expr b->foo()" ok. "expr d.foo()" crashes. }
The reason is that without an overrides table, the definition of foo in derived is treated as a new method definition (rather than an override) and allocated its own vtable entry which does not exist in the vtable of Derived in the compiled program.
Could you add some doxygen comments explaining what the new function do and why doing this is necessary?