c++.beta - DM 8.39 Inheritance Bug ?
- Riccardo Macri (52/52) Feb 20 2004 The following runs to completion under 8.38 but crashes if compiled with...
- Walter (1/1) Feb 20 2004 Fixed in 8.40.
The following runs to completion under 8.38 but crashes if compiled with 8.39. Am I breaking a rule somewhere? The code this was extracted from has been fine for years. #include <stdio.h> // // The EXE produced by DM 8.39 crashes with this code! // // compile with "sc rickbug -mn" class IFScrnRect { public: IFScrnRect() {} virtual ~IFScrnRect() {} }; class SelectableObject { // // Note: the bug disappears if the "static" RectUpdate() is renamed to // something different. // public: SelectableObject() {} virtual ~SelectableObject() {} static void RectUpdate() {} virtual void RectUpdate(int cmd); }; void SelectableObject::RectUpdate(int cmd) { // this is what we expect main() To call printf("RectUpdate:cmd is %d\n",cmd); } class BadText : public IFScrnRect, public SelectableObject { public: BadText() {} virtual ~BadText() {} }; main() { printf("1"); BadText * t = new BadText(); printf("2"); // DM 8.39 crashes here. v8.38 and SC 7.5 are OK // // In the full application it seems it was calling the wrong function. t->RectUpdate(123); printf("3"); delete t; printf("4"); return 0; }
Feb 20 2004