Return of the killer templates (gcc-2.95 ICE)

Paul Burchard burchard@pobox.com
Wed Aug 4 14:12:00 GMT 1999


The self-contained program shown below ICEs gcc-2.95 release.  The
problem is connected with my use of the the nested template
	Q<long>::X
as a template template parameter.  Actually, my current reading of
[temp.names] in the C++ Standard is that the above is not a valid
template name, and should be replaced by
	Q<long>::template X
but gcc disagrees, flagging the latter as a syntax error.  Direct
instantiation of the same template as, e.g.,
	Q<long>::X<int> foo;
works fine.


///////////////////////////////////////////////////////////////////
template<class S> struct Q {
	template<class T> class X {};
};
template<template<class> class XX> struct Y {};
int main() {
	Y<Q<long>::X> y;
}
///////////////////////////////////////////////////////////////////


Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95/specs
gcc version 2.95 19990728 (release)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95/cpp -lang-c++ -v
-D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__
-Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__
-D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Wall -Acpu(i386)
-Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686
-D__i686__ -D__pentiumpro -D__pentiumpro__ bug.5.cc /tmp/ccKll5G9.ii
GNU CPP version 2.95 19990728 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95/../../../../include/g++-3
 /usr/local/include

/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95/../../../../i686-pc-linux-gnu/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95/include
 /usr/include
End of search list.
The following default directories have been omitted from the search
path:
End of omitted list.
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95/cc1plus /tmp/ccKll5G9.ii
-quiet -dumpbase bug.5.cc -Wall -version -o /tmp/ccoBHvJa.s
GNU C++ version 2.95 19990728 (release) (i686-pc-linux-gnu) compiled by
GNU C version 2.95 19990728 (release).
bug.5.cc: In function `int main()':
bug.5.cc:6: Internal compiler error 980422.
bug.5.cc:6: Please submit a full bug report.
bug.5.cc:6: See <URL: http://egcs.cygnus.com/faq.html#bugreport > for
instructions.

-- 
----------------------------------------------------------------------
Paul Burchard   <burchard@pobox.com>   http://www.pobox.com/~burchard/
----------------------------------------------------------------------


More information about the Gcc-bugs mailing list