Sorry if I ask something trivial about C++, but I have not found an appropriate answer.
It looks like there are at least two versions of ::operator delete in C++, and in particular Clang and GCC use distinct versions, as can be demonstrated here:
#include <iostream>
#include <memory>
void operator delete(void *) noexcept { std::cout << "delete1 "; }
void operator delete(void *, std::size_t) noexcept { std::cout << "delete2 "; }
int main()
{
auto x = std::make_shared<int>();
}
Clang prints delete1 and GCC prints delete2 ( https://gcc.godbolt.org/z/TWavo37dG ).
So if one writes a program that must be compatible with any C++ compiler then both function versions must be provided, right?