optimzer bug [?]

John F. Dumas jdumas@locutus.kingwoodcable.com
Sun Dec 5 14:35:00 GMT 1999


On Sun, 5 Dec 1999, Martin v. Loewis wrote:

> > When I compile the above code with g++ 2.95 on linux without optimization
> > it compiles/works fine but when I compile with optimization I get:
> 
> Thanks for your bug report. This is fixed in mainline compiler (2.96
> 19991202 (experimental)).
> 
> Regards,
> Martin

Right on, thanks for the response - I did have one other wierd problem,
the following code:

#include <iostream.h>

class Test
{
   public:
      Test()  { cout << "Test()" << endl;  }
      ~Test() { cout << "~Test()" << endl; }

   private:
      static void operator delete(void *ptr);
};

int main()
{
   Test *t = new Test();
   return(0);
}

does not compile with 2.95, it says:

test.cpp: In function `int main()':
test.cpp:10: `static void Test::operator delete(void *)' is private
test.cpp:15: within this context

the above code does compile with other c++ compilers (though no other g++
variants I know of).  Odder still, the above code will compile if I add
'friend' to the beginning of 'static void operator delete(void *ptr);'
Is this also a bug?

//***********************************************************************
//  John F. Dumas                           Contract Software Developer
//  5311 Jasper Grove     Unix, Win32, Web - C/C++, Java, CGI Scripting
//  Kingwood TX, 77345      jdumas[at]locutus[dot]kingwoodcable[dot]com
//  (281)-360-9264                    http://locutus.kingwoodcable.com/
//***********************************************************************



More information about the Gcc-bugs mailing list