c++/5756: ICE on bad typedef

jcab@JCABs-Rumblings.com jcab@JCABs-Rumblings.com
Sat Feb 23 07:56:00 GMT 2002

>Number:         5756
>Category:       c++
>Synopsis:       ICE on bad typedef
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-illegal-code
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 23 00:06:00 PST 2002
>Originator:     Juan Carlos Arevalo-Baeza
>Release:        3.0.3
It looks like, in some cases, defining a typedef of a template without providing template parameters, ICEs the compiler.

Below, there's a tiny code snippet that shows the problem.
Just compile the following program:

namespace KK {

template < typename GrammarT >
struct grammar_filter {
    template < typename IteratorT >
    class iterator {};

struct cpp_lexer_phase_1 {

typedef typename grammar_filter<cpp_lexer_phase_1>::iterator


I get:

$ g++ bug1.cpp -O2 -ftemplate-depth-50 -g -v -save-temps
Reading specs from /usr/local/lib/gcc-lib/i686-pc-cygwin/3.0.3/specs
Configured with: ../gcc-3.0.3/configure --enable-threads=win32
Thread model: win32
gcc version 3.0.3
 /usr/local/lib/gcc-lib/i686-pc-cygwin/3.0.3/cpp0.exe -lang-c++ -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -v -D
__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=3 -D_X86_=1 -D_X86_=1 -Asystem=winnt -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amac
hine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__(
(__cdecl__)) -D_stdcall=__attribute__((__stdcall__)) -D_cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386__ -D__i
386 -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -isystem /usr/local/include -idirafter /usr/local/i686-pc-cygwin/include -idiraft
er /usr/include -idirafter /usr/local/i686-pc-cygwin/include/w32api -idirafter /usr/include/w32api bug1.cpp bug1.ii
ignoring nonexistent directory "/usr/local/i686-pc-cygwin/include"
ignoring nonexistent directory "/usr/local/i686-pc-cygwin/include/w32api"
GNU CPP version 3.0.3 (cpplib) (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
End of search list.
 /usr/local/lib/gcc-lib/i686-pc-cygwin/3.0.3/cc1plus.exe -fpreprocessed bug1.ii -quiet -dumpbase bug1.cpp -g -O2 -version -ftemplate-depth-5
0 -o bug1.s
GNU CPP version 3.0.3 (cpplib) (80386, BSD syntax)
GNU C++ version 3.0.3 (i686-pc-cygwin)
        compiled by GNU C version 3.0.3.
bug1.cpp:13: Internal error #2000.
bug1.cpp:13: Internal compiler error in make_typename_type, at cp/decl.c:5659
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
The code is actually broken. Correct code seems to work OK.

More information about the Gcc-bugs mailing list