This code (for better or worse) appeared to have built with 4.0.1. By adding the "class" stuff in the template specialization the static member was actually instantiated. With just <> no instantiation occurred. g++ -v -save-temps -c tmp.cc Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --with-tune=i686 --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) /usr/lib/gcc/i486-linux-gnu/4.1.2/cc1plus -E -quiet -v -D_GNU_SOURCE tmp.cc -mtune=i686 -fpch-preprocess -o tmp.ii ignoring nonexistent directory "/usr/local/include/i486-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../i486-linux-gnu/include" ignoring nonexistent directory "/usr/include/i486-linux-gnu" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2 /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/backward /usr/local/include /usr/lib/gcc/i486-linux-gnu/4.1.2/include /usr/include End of search list. /usr/lib/gcc/i486-linux-gnu/4.1.2/cc1plus -fpreprocessed tmp.ii -quiet -dumpbase tmp.cc -mtune=i686 -auxbase tmp -version -o tmp.s GNU C++ version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) (i486-linux-gnu) compiled by GNU C version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21).GGC heuristics: --param ggc-min-expand=81 --param ggc-min-heapsize=96557 Compiler executable checksum: 183d42a838ed2b7313bffcb8f2f2fda7 tmp.cc: In constructor ‘ChainHashTable<Key, Value, HashFunc>::ChainHashTable() [with Key = const elfsymbol*, Value = CF::ElxrFunction*, HashFunc = elfsymbol_hash]’: tmp.cc:35: instantiated from ‘MemoryManager<ChainHashTable<const elfsymbol*, CF::ElxrFunction*, elfsymbol_hash>::Link> ChainHashTable<const elfsymbol*, CF::ElxrFunction*, elfsymbol_hash>::linkmanager’ tmp.cc:35: instantiated from ‘ChainHashTable<Key, Value, HashFunc>::ChainHashTable() [with Key = const elfsymbol*, Value = CF::ElxrFunction*, HashFunc = elfsymbol_hash]’ tmp.cc:65: instantiated from here tmp.cc:35: internal compiler error: in instantiate_decl, at cp/pt.c:11775 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. For Debian GNU/Linux specific bug reporting instructions, see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>. Preprocessed source stored into /tmp/ccy7OWHQ.out file, please attach this to your bugreport. I don't see a way to attach the file, but perhaps that's available after I commit...
Created attachment 16591 [details] preprocessed file for ICE
To make things short: The bug is a duplicate of PR24791. > This code (for better or worse) appeared to have built with 4.0.1. By adding >the "class" stuff in the template specialization the static member was actually >instantiated. The "class stuff" is invalid. As mentioned in PR24791, GCC 4.0.0 -4.0.2 did not crash on the code. All other releases before GCC 4.3.0 did. > With just <> no instantiation occurred. Because this is just a declaration and not a definition for the static member. You need to add an initializer to make it a definition. Then this should work as expected. *** This bug has been marked as a duplicate of 24791 ***