problems with g++-4.1
this program:
#include <stdio.h>
#include <stdlib.h>
struct A {
void* operator new(size_t alloc_size) {
printf("A::operator new()\n");
return malloc(alloc_size);
};
void operator delete(void* p, size_t s) {
printf("A::delete %d\n", s);
};
A() {printf("A constructing\n"); throw 2;};
virtual ~A() {}
};
int
main() {
try {
A* ap = new A;
delete ap;
}
catch(int e) {printf("caught %i\n",e); return 1;}
}
compiles okay with g++-4.0 but when i try to compile it with g++-4.1 i
get:
In destructor 'virtual A::~A()':
17: error: no suitable 'operator delete' for 'A'
In function 'int main()':
24: error: no suitable 'operator delete' for 'A'
25: error: no suitable 'operator delete' for 'A'
27: confused by earlier errors, bailing out
any ideas how to fix it?
--alex--
--
| I believe the moment is at hand when, by a paranoiac and active |
| advance of the mind, it will be possible (simultaneously with |
| automatism and other passive states) to systematize confusion |
| and thus to help to discredit completely the world of reality. |
Reply to: