Well, first of all, deleting a derived object through a base pointer when the base class does not have a virtual destructor is undefined behavior. Compilers are not required to diagnose undefined behavior…
That being said, the reason why this warning does not appear when using std::unique_ptr
is most likely due to the fact that GCC does not report warnings that would appear in system headers.