9474 – [3.2 regression] GCC freezes in compiling a weird code mixing and <iostream.h> (original) (raw)
| When I try to compile the following C++ source code, cc1plus never finishes and runs forever. ------------------ temp.cc #include typedef std::istream istream; #include <iostream.h> ------------------ temp.cc (end) Of course the source is weird, but gcc should report some error and exit. I ran into this problem when managing a C++ code using flex 2.5.4a. The <FlexLexer.h> attached to the latest flex source code still uses <iostream.h>, but I want to switch ... Release: gcc version 3.2.2 20030109 (Debian prerelease) Environment: Debian GNU/Linux with kernel 2.4.20 $ gcc -v Reading specs from /usr/lib/gcc-lib/i386-linux/3.2.2/specs Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux Thread model: posix gcc version 3.2.2 20030109 (Debian prerelease) How-To-Repeat: $ cat temp.cc #include typedef std::istream istream; #include <iostream.h> $ g++ temp.cc In file included from /usr/include/c++/3.2/backward/iostream.h:31, from temp.cc:3: /usr/include/c++/3.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the <X.h> header for C++ includes, or instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated. ... compiles forever ... Comment 2 Christian Ehrhardt 2003-01-28 14:01:22 UTC State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed. Here's a reduced testcase, probably illegal but I'm not 100% sure. This is actually an infinite loop in gcc, not an ICE but I'll leave this in ICE on illegal for the moment. ---------- cut ---------- namespace X { typedef struct { } x; }; typedef X::x x; using X::x; ---------- cut ---------- This is a regression from 2.95 which issued this error: t.cc:6: using directive `x' introduced ambiguous type `X::x' The loop is in the function original_type in gcc/cp/typeck.c because the decl for ::x references itself in DECL_ORIGINAL_TYPE (TYPE_NAME (x)). regards Christian Comment 3 Mark Mitchell 2003-03-12 03:33:11 UTC Responsible-Changed-From-To: unassigned->mmitchel Responsible-Changed-Why: Working on a fix. Comment 5 Joe Buck 2003-04-25 20:19:22 UTC State-Changed-From-To: analyzed->closed State-Changed-Why: Fixed for 3.3. | | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |