Command line: $ g++ testcase.C ----- testcase.C ----- template < typename > class A; template < typename T > A < T >::B::~B () {} ---------------------- Compiler output: $ g++ testcase.C testcase.C:2:25: error: 'A< <template-parameter-1-1> >::B' is not a type testcase.C:2:41: internal compiler error: tree check: expected identifier_node, have bit_not_expr in grokdeclarator, at cp/decl.c:8113 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Tested revisions: r162222 - crash 4.4 r149995 - crash
Confirmed. 4.3.2 works.
It failed for me with gcc 4.2.0 and 4.3.0: [hjl@gnu-26 rrs]$ cat pr45043.cc template < typename > class A; template < typename T > A < T >::B::~B () {} [hjl@gnu-26 rrs]$ /export/gnu/import/rrs/117167/usr/bin/gcc -S pr45043.cc pr45043.cc:2: error: \u2018A< <template-parameter-1-1> >::B\u2019 is not a type pr45043.cc:2: internal compiler error: tree check: expected identifier_node, have bit_not_expr in grokdeclarator, at cp/decl.c:7178 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. [hjl@gnu-26 rrs]$ /export/gnu/import/rrs/117167/usr/bin/gcc -v Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../src/configure --prefix=/export/gnu/import/rrs/117167/usr --enable-clocale=gnu --with-system-zlib --with-demangler-in-ld --enable-shared --enable-threads=posix --enable-haifa --enable-checking --enable-languages=c,c++,fortran --disable-bootstrap Thread model: posix gcc version 4.2.0 20060923 (experimental) [hjl@gnu-26 rrs]$ /export/gnu/import/rrs/125623/usr/bin/gcc -v Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../src/configure --prefix=/export/gnu/import/rrs/125623/usr --enable-clocale=gnu --with-system-zlib --with-demangler-in-ld --enable-shared --enable-threads=posix --enable-haifa --enable-checking --enable-languages=c,c++,fortran --disable-bootstrap Thread model: posix gcc version 4.3.0 20070611 (experimental) [hjl@gnu-26 rrs]$
[hjl@gnu-26 rrs]$ /export/gnu/import/rrs/125623/usr/bin/gcc -S pr45043.cc pr45043.cc:2: error: \u2018A< <template-parameter-1-1> >::B\u2019 is not a type pr45043.cc:2: internal compiler error: tree check: expected identifier_node, have bit_not_expr in grokdeclarator, at cp/decl.c:7365 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. [hjl@gnu-26 rrs]
Just checking that TREE_CODE (dname) == IDENTIFIER_NODE before using MAIN_NAME_P on it appears to fix the issue.
Subject: Bug 45043 Author: paolo Date: Mon Aug 30 18:13:32 2010 New Revision: 163655 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163655 Log: /cp 2010-08-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/45043 * decl.c (grokdeclarator): Use MAIN_NAME_P only on IDENTIFIER_NODEs. /testsuite 2010-08-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/45043 * g++.dg/template/crash102.C: New. Added: trunk/gcc/testsuite/g++.dg/template/crash102.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/testsuite/ChangeLog
Fixed for 4.6.0.
Fixed.