I am pretty much sure it is but if I am interpreting correctly the standard (Section 18.6.1.2 new.delete.array) mentions that:
void operator delete[](void* ptr) noexcept; pointer.
. 13 Default behavior: Calls operator delete(ptr)
Since in its default behavior delete[] just calls its delete(ptr) equivalent why should it matter which version is called? I tried with a sample code to verify this and it crashes making it more evident that mismatching new[] and delete indeed lead to bad things
#include <iostream>
#include <memory>
class foo{
public:
void bar(){
std::cout << "foo's bar" << std::endl;
}
~foo(){
std::cout << "foo dies after this" << std::endl;
}
};
int main() {
std::shared_ptr<foo> x(new foo[10]);
return 0;
}
How should the above quoted line from the standard be interpreted?