From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225 Description of problem: #include <iostream> #include <fstream> using namespace std; int main () { int i = 0; switch ( i ) { case 0: ifstream input; break; case 1: cout << "This is case 1" << endl; } } The above code when compiled on my RedHat 9 Linux system yields the following error message: ifs2.cpp: In function `int main()': ifs2.cpp:13: jump to case label ifs2.cpp:10: crosses initialization of `std::ifstream input' Internal compiler error: Error reporting routines re-entered. Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions. G++ on other systems rejects the code as well, but do not report internal compiler error problems. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. Copy the above source code to a CPP file. 2. Use G++ to compile the source file. Actual Results: Internal compiler error: Error reporting routines re-entered. Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions. Expected Results: From a DEC UNIX machine: (uname -a: OSF1 V4.0 1091 alpha) (g++ --version: 2.95.3) ifs2.cpp: In function `int main()': ifs2.cpp:14: case label `1' within scope of cleanup or variable array ifs2.cpp:10: warning: destructor needed for `class ifstream input' ifs2.cpp:14: warning: where case label appears here ifs2.cpp:14: warning: (enclose actions of previous case statements requiring ifs2.cpp:14: warning: destructors in their own binding contours.) ifs2.cpp:14: jump to case label ifs2.cpp:10: crosses initialization of `class ifstream input' Additional info:
Fails through gcc 3.2.3-20; fixed in gcc 3.3.2-1.