Bug Report: delete fails when virtual base class has virtual destructor - CW S12X V5 CHC12.EXE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug Report: delete fails when virtual base class has virtual destructor - CW S12X V5 CHC12.EXE

849 Views
eJames
Contributor I

The example shown below reproduces the problem. This was compiled in a brand new C++ project with no other user code involved. Sample project attached to this post for reference.

 

Here are two changes that will prevent the error (but not solve the problem):

- make the ~Entity() destructor non-virtual

- do not use virtual inheritance for Object and Interface

 

Here is a work-around:

- delete '(Entity*)ptr' instead of 'ptr'

 

 

#include <hidef.h>#include "derivative.h"class Entity{    public:        virtual ~Entity() { }};class Object : public virtual Entity { /*...*/ };class Interface : public virtual Entity { /*...*/ };class MyClass : public Object, public Interface{    public:        virtual ~MyClass() { }};void main(void){    MyClass* ptr = new MyClass;        delete ptr;    // Error : C5701: Internal Error #604 in 'f:\build\Products\Hiware\cw_hc12_Build_Tools\hiware\src\ccpp\ccpp.cpp'    // while compiling file 'C:\dev\projects\spike\test_project\Sources\main.cpp', procedure 'main', please report to Freescale        EnableInterrupts;    for(;;) { _FEED_COP(); }}
Labels (1)
0 Kudos
3 Replies

518 Views
J2MEJediMaster
Specialist I

You need to file an on-line service request to report this problem. Click here to do that. You will want to send them your code sample to help reproduce the error.

 

---Tom

0 Kudos

518 Views
eJames
Contributor I

Thanks, Tom. I have submitted a service request.

 

Is that the proper way to submit a bug report? I looked around on the website and could not find a definitive answer, but I did see several "Bug Report:" forum messages so I assumed that this was the proper way.

0 Kudos

518 Views
J2MEJediMaster
Specialist I

If you're having a problem, the first thing to do is ask here in the forums. There's a lot of knowledgeable people here who can help you out. Occasionally the problem will be so hard to deal with that it requires you file a service request.

 

Having said that, if the problem is a reproducible bug, the best course of action is to file a service request so that it gets the attention of the engineers. Some of them do patrol the forums, but by filing a service request you start a formal process to where the probem is recorded and does have to be looked into.

 

---Tom

0 Kudos