February 20, 2004 DM 8.39 multiple inheritance bug ? | ||||
---|---|---|---|---|
| ||||
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; } |
February 21, 2004 Re: DM 8.39 multiple inheritance bug ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Riccardo Macri | Can you repost after converting tabs to spaces "Riccardo Macri" <Riccardo_member@pathlink.com> wrote in message news:c158t9$2e3v$1@digitaldaemon.com... > 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; > } > > > |
Copyright © 1999-2021 by the D Language Foundation