From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) Description of problem: I've been able to get g++ to crash when a method of a class is called that new's an instance of a class that is defined within the method, and where this locally defined class does not have a destructor and the class it is derived from has a virtual destructor. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. Put the following code into a file named "test.cpp" (this is small enough that I thought I could include it here): class BaseClass { public: virtual ~BaseClass () {}; }; class Test { public: static void Foo() { class LocalClass: public BaseClass { public: // ~LocalClass() {}; }; new LocalClass; } }; main() { Test::Foo(); }; 2. Compile it as follows: g++ -Wall -g -O -c -w -D_REENTRANT -Wunused -fsigned-char -fsigned-bitfields test.cpp Actual Results: The following message was displayed: test.cpp: In method `Test::Foo ()::LocalClass::~LocalClass ()': test.cpp:24: Internal error: Segmentation fault. Please submit a full bug report. See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions. Expected Results: The code should have compiled without errors. Additional info: The workaround for this problem is to write a destructor for LocalClass. While this fixes the problem, it is completely unnecessary to have a destructor in my case.
This works in 8.0 / gcc 3.2 unoptimised If you optimise it this triggers an infinite loop in the compiler..
Cannot reproduce this with gcc-3.2.2-1 from rawhide.