Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class A {
- int i;
- public:
- static void* operator new(std::size_t size) throw(std::bad_alloc) {
- return malloc(size);
- }
- static void operator delete(void* p) throw() {
- cout << "delete" << endl;
- free(p);
- }
- A() throw(std::exception) {
- throw exception();
- }
- };
- void operator delete(void* p) throw() {
- cout << "delete" << endl;
- free(p);
- }
- int main() {
- A* a = new A;
- }
- terminate called after throwing an instance of 'std::exception'
- what(): std::exception
- [1] 28476 abort ./test_clion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement