I came across an issue which I could not resolve.
My question is, if I used malloc to allocate memory and then memory block is delete using delete
malloc
delete
From the documentation,
void free (void* ptr);
ptr::
Pointer to a memory block previously allocated with malloc, calloc or realloc.
And what you are passing is not a pointer, so it complains.
A *b = new A(); cout << b->lol() << endl; free(b); // Will Not cause error