Can i use smth like the following code:
int main()
{
int* foo = new int;
double* bar = reinterpret_cast<double*>(foo);
delete bar;
}
Is it UB?
I think that we need to call operator delete only for pointers returned by operator new, but what about casting in this case?
I think that it's UB since the reinterpret_cast don't give any guarantees about the resulting pointer. Am i right?
Can somebody post the right quote from the standard, please?