[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: problems with g++-4.1



Alex Romosan writes:
> 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?

we currently revert the patch for PR c++/26068 to work around PR c++/27884

Martin, maybe we can add a workaround in the Perl headers instead?

  Matthias



Reply to: