struct B{};
struct D : B{};
void fun()
{
B* b = new D{};
delete b;
}
Error output
```console
:8:5: warning: Destruction of a polymorphic object with no virtual destructor [clang-analyzer-alpha.cplusplus.DeleteWithNonVirtualDtor]
delete b;
^~~~~~~~
:7:12: note: Conversion from derived to base happened here
B* b = new D{};
^~~~~~~
:8:5: note: Destruction of a polymorphic object with no virtual destructor
delete b;
^~~~~~~~
1 warning generated.
```
The following code will trigger
clang-analyzer-alpha.cplusplus.DeleteWithNonVirtualDtor
https://godbolt.org/z/dxdYe1zc8Error output
```consoleLooking at the code in
DeleteWithNonVirtualDtorChecker.cpp
it looks like we are missing a check forDerivedClass->isPolymorphic()