Skip to main content

IAR Embedded Workbench for Arm 9.70.x

CPU-delete-void (C++ only)

In this section:
Synopsis

A pointer to void is used in delete, causing the destructor not to be called.

Enabled by default

Yes

Severity/Certainty

Medium/Medium

mediummedium.png
Full description

A pointer to void is used in delete. When delete is called on a void pointer in C++, the object is deallocated from memory but its destructor is not called.

Coding standards

This check does not correspond to any coding standard rules.

Code examples

The following code example fails the check and will give a warning:

void example(void *a) {
  delete a;
}

The following code example passes the check and will not give a warning about this issue:

void example(int *a) {
  delete a;
}