void test() {
int *p = (int *)malloc(sizeof(int));
delete p;
}
void __attribute((ownership_returns(malloc))) *user_malloc(size_t);
void test() {
int *p = (int *)user_malloc(sizeof(int));
delete p;
}
void test() {
int *p = new int;
free(p);
}
void test() {
int *p = new int[1];
realloc(p, sizeof(long));
}
template <typename T>
struct SimpleSmartPointer {
T *ptr;
explicit SimpleSmartPointer(T *p = 0) : ptr(p) {}
~SimpleSmartPointer() {
delete ptr;
}
};
void test() {
SimpleSmartPointer<int> a((int *)malloc(4));
}
void test() {
int *p = (int *)operator new(0);
delete[] p;
}
void test(NSUInteger dataLength) {
int *p = new int;
NSData *d = [NSData dataWithBytesNoCopy:p
length:sizeof(int) freeWhenDone:1];
}